cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
438 stars 67 forks source link

Match current Docusaurus search styling #32

Closed ivailop7 closed 3 years ago

ivailop7 commented 3 years ago

Hi, great work on the plugin! Thank you!

Are you considering refreshing the styling of the autocomplete to match the current Docusaurus styling or at least display the text around the matching term. Similar to what is done here, but the indexing of yours plugin is better when it comes to matching whole phrases.

cmfcmf commented 3 years ago

Hi! I'm glad you like this plugin 🎉 I've been working on an updated design in https://github.com/cmfcmf/docusaurus-search-local/pull/34, but there are still a few roadblocks to solve until its ready.

ivailop7 commented 3 years ago

Looks great! Is the styling swizzled from the latest docusaurus-theme-search-algolia v72, I thought it supported dark mode out of the box. Great work! Looking forward to the end result!

cmfcmf commented 3 years ago

This is rather complicated to explain, let me try :)

In the PR, I use @algolia/autocomplete-js v1-alpha.44 in conjunction with their predefined theme @algolia/autocomplete-theme-classic to render the searchbar and dropdown.

docusaurus-theme-search-algolia uses Algolia Docsearch (@docsearch/react 3.0.0-alpha.33), which uses the same library to render the searchbar and autocomplete (algolia/autocomplete-core v1-alpha.35), but with a custom theme (@docsearch/css 3.0.0-alpha.33).

-> I did not swizzle the search plugin, but used the same underlying library. I'll figure out over the next few days what the best solution for decent and possibly configurable styling would be. I'm also waiting for a new alpha release of @algolia/autocomplete-js (which presumably should be out soon) that should fix a few of the problems I was having.

ivailop7 commented 3 years ago

I see. It does sound complicated. I tried a few weeks back with the swizzled version, but I had to make an adapter of connecting the Lunr results to the swizzled components API interface, which was non-modifiable and decided to skip. Based on what I discovered playing with it, I understand why you've went with this approach.

cmfcmf commented 3 years ago

The updated design has now been released as part of https://github.com/cmfcmf/docusaurus-search-local/releases/tag/v0.6.0. 🎉