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

Customizable search button #107

Closed LookRain closed 2 years ago

LookRain commented 2 years ago

I'm very satisfied with this plugin so far, however, the default search button does not really fit my docsite. So is there any way to customize the UI for the button? If not, is it a planned feature for future versions? thanks

image

marcusnewton commented 2 years ago

You can target it using the global stylesheet under src/css/custom.css

LookRain commented 2 years ago

got it. It works for me for now, but it would be great if we can replace the default button with a React component if the design deviates from the default one too much and customizing CSS is not enough.

gentledepp commented 2 years ago

Could you please give me a hint what I am doing wrong?

1) I installed the plugin just as described in your wiki and a normal docusaurus v2 configuration using presets classic: image

2) when adding the following lines to my custom css, they do not have any effect: image

So I fired up chrome dev tools and it seems, that my custom.css is inserted into the html BEFORE the searchbar css is added: image

So

  1. is there a way to change the order of the css definitions, so that my custom.css can actually override the existing variables?
  2. or am I doing something fundamentally wrong here?
ItsJustMiaouss commented 2 years ago

Hey @gentledepp,

If you want to change the color using the root variables you have to:

  1. Use the RGB colors instead of the default CSS shortcut or HEX (e.g 255, 0, 0 instead of red or #ff1100).
  2. Make sure you have set the priority !important after defining the color to override the previous styling rules.

Example:

:root {
  --aa-primary-color-rgb: 255, 0, 0 !important;
  --aa-muted-color-rgb: 255, 0, 0 !important;
  /* ... */
}

If you use the dark theme, then replace :root { ... } by [data-theme='dark'] { ... }.

gentledepp commented 2 years ago

This totally worked. Thank you so much!!

cmfcmf commented 2 years ago

Thanks @ItsJustMiaouss! I linked your comment from the README :)