Skip to content

Add option to enable/disable dark mode #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2021

Conversation

mdubus
Copy link
Member

@mdubus mdubus commented Jun 8, 2021

fixes: #341

What's wrong ?

If a user has his preferences set to dark mode, but the website using docs-searchbar don't have support for dark mode, the website will appear in light mode except for the searchbar, which will appear in dark mode.

What's inside this PR

This PR adds an option enableDarkMode to allow users enable dark mode on the searchbar. It is set to false by default.

How to test

To switch between dark and light mode, go to System Preferences in your mac and then General.

To run the project: yarn && yarn playground and go to http://localhost:1234/

You can also try the searchbar with the option layout: simple if you want to !

Light mode

Just run the project, and switch between light & dark mode in your system preferences.

Dark mode

Go to the project, and add enableDarkMode: true to the playground you want to use.
Example in playgrounds/html/index.html :

Capture d’écran 2021-06-09 à 11 26 21

Screenshots

Light mode:
Capture d’écran 2021-06-09 à 11 31 15

Dark mode with enableDarkMode set to true:

Capture d’écran 2021-06-09 à 11 31 02

Dark mode without enableDarkMode:

  • dark background kept to show that the dark mode is enabled in user's system preferences
  • show that even in dark mode, the searchbar is displayed in light mode if enableDarkMode isn't set

Capture d’écran 2021-06-09 à 11 31 43

@mdubus mdubus force-pushed the add_option_enable_dark_mode branch from d33b03a to 2fe9d04 Compare June 8, 2021 15:12
@mdubus mdubus changed the title Add option enable dark mode Add option to enable dark mode Jun 8, 2021
@bidoubiwa
Copy link
Contributor

bors try

@bors
Copy link
Contributor

bors bot commented Jun 9, 2021

try

Merge conflict.

@mdubus mdubus force-pushed the add_option_enable_dark_mode branch from 42155a0 to 95eab70 Compare June 9, 2021 09:19
@mdubus mdubus marked this pull request as ready for review June 9, 2021 09:39
@mdubus mdubus requested a review from bidoubiwa June 9, 2021 14:26
Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥

@bidoubiwa
Copy link
Contributor

bors try

bors bot added a commit that referenced this pull request Jun 9, 2021
@bors
Copy link
Contributor

bors bot commented Jun 9, 2021

try

Build succeeded:

@bidoubiwa
Copy link
Contributor

bors try

bors bot added a commit that referenced this pull request Jun 10, 2021
@bors
Copy link
Contributor

bors bot commented Jun 10, 2021

try

Build succeeded:

@bidoubiwa
Copy link
Contributor

bors merge

@bors
Copy link
Contributor

bors bot commented Jun 10, 2021

Build succeeded:

@bors bors bot merged commit 5476cb4 into meilisearch:main Jun 10, 2021
@bidoubiwa bidoubiwa changed the title Add option to enable dark mode Add option to enable/disable dark mode Jun 10, 2021
@mdubus mdubus deleted the add_option_enable_dark_mode branch June 10, 2021 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create environment where dark mode can be disabled or enabled
2 participants