hipstersmoothie / storybook-dark-mode

A storybook addon that lets your users toggle between dark and light mode.
MIT License
435 stars 56 forks source link

Darkmode does not account for Parameter inheritance with the darkClass/lightClass properties #170

Open ta11ey opened 2 years ago

ta11ey commented 2 years ago

Darkmode does not work with Parameter Inheritance.

see here for rules of parameter inheritance

Expected Behavior: When you override the darkClass and lightClass at a story level, the classes set from the preview.js level are removed, and vice versa when leaving that story.

Actual Behavior: it will add the new classes defined in the story level parameters without removing the ones you set in preview.js. and then when you go back to a story where you are wanting to fall back to the default parameters it will leave the inherited ones on the classTarget element

hipstersmoothie commented 1 year ago

I could see lots of problems coming from this. What if you are looking at a docs view where different components expect different light/dark classes?

Willing to review a PR if you find that's not an issue