documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[Docs] Save user theme preference

Open michaeloliverx opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. I use the docs of react-hook-form quite often and I always have to switch the theme back to light mode.

Describe the solution you'd like I would love if the website remembered my previous selection.

Describe alternatives you've considered Manually doing it each time 😢

Additional context

michaeloliverx avatar Oct 07 '22 15:10 michaeloliverx

Are you referring to the same docs as this? If yes, the website remembers my theme selection.

griimick avatar Oct 07 '22 16:10 griimick

Are you referring to the same docs as this? If yes, the website remembers my theme selection.

Yes that site, once I close the tab and go back it always defaults to dark for me 🤷🏻‍♂️

michaeloliverx avatar Oct 07 '22 16:10 michaeloliverx

.@michaeloliverx @griimick

Documentation site is using "little-state-machine" with default option to persist data to session storage therefore the dark/light mode is only available on each tab.

@bluebill1049

Can we add "storageType" option with value local storage when creating store ?

Referrer: https://github.com/beekai-oss/little-state-machine#-createstore

File to be updated: https://github.com/react-hook-form/documentation/blob/master/with-little-state-machine.js

leapful avatar Oct 07 '22 17:10 leapful

Makes sense. I would suggest using local storage as well.

griimick avatar Oct 07 '22 17:10 griimick

Documentation site is using "little-state-machine" with default option to persist data to session storage therefore the dark/light mode is only available on each tab.

Yea sure, PR welcome on this 👍

bluebill1049 avatar Oct 07 '22 21:10 bluebill1049