hipstersmoothie / storybook-dark-mode

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

Theme selection doesn't persist for the Docs tab #70

Open mboudriga opened 5 years ago

mboudriga commented 5 years ago

When using the storybook docs addon, the theme will snap back to the default theme. So if you select dark mode then click on the docs tab, the theme will snap to light and its jarring.

chrisguerrero commented 5 years ago

I'm having the same issue. If you configure Storybook to use its built in dark theme, the docs tab is styled with the dark theme:

dark_mode_default

When the storybook-dark-mode addon is enabled and configured, the docs tab does not use the dark theme when you switch to dark mode:

dark_mode_with_addon

The toggle for switching between light/dark mode also disappears when you change to the docs tab.

hipstersmoothie commented 5 years ago

I might not get a chance to look at this for awhile. Prs very appreciated

On Wed, Nov 20, 2019 at 1:33 PM Chris Guerrero notifications@github.com wrote:

I'm having the same issue. If you configure Storybook to use its built in dark theme https://storybook.js.org/docs/configurations/theming/#global-theming, the docs tab is styled with the dark theme:

[image: dark_mode_default] https://user-images.githubusercontent.com/3720304/69279944-3927cc00-0b9a-11ea-849c-00b31c61357c.png

When the storybook-dark-mode addon is enabled and configured, the docs tab does not use the dark theme when you switch to dark mode:

[image: dark_mode_with_addon] https://user-images.githubusercontent.com/3720304/69279957-3f1dad00-0b9a-11ea-8bb3-9bbd377f1277.png

The toggle for switching between light/dark mode also disappears when you change to the docs tab.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hipstersmoothie/storybook-dark-mode/issues/70?email_source=notifications&email_token=AAJDEBGNQLKBUGOXV2J35ZLQUWULPA5CNFSM4JOUUKVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEVGKDQ#issuecomment-556426510, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJDEBDNPSV33GPTVKLZHL3QUWULPANCNFSM4JOUUKVA .

bsastregx commented 5 years ago

Same issue here, but with the Notes tab, instead of the Docs tab

unnamed

austincondiff commented 4 years ago

I am having the same issue here. When in the docs tab the dark mode toggle disappears as well. Any movement here.

hipstersmoothie commented 4 years ago

I will still merge any PR that fixes the issue 🚀

angelolucas commented 4 years ago

It seams to be a issue with the Docs Addon.

I created a custom addon that does something like this one, manipulating the Storybook theme through the api:

// inside my addon

api.setOptions ({
  theme: themes[base],
});

Only Storybook matches, Docs don't change. Docs works with the dark theme just by adding through addParametes:

// config.js

import { themes } from '@storybook/theming';

addParameters({
  options: {
    theme: themes.dark,
  },
angelolucas commented 4 years ago

I opened an issue on the Storybook and got a response:

In 6.0 we've moved to a parallel theming structure for docs:

https://github.com/storybookjs/storybook/blob/next/addons/docs/docs/theming.md#storybook-theming

https://github.com/storybookjs/storybook/issues/10523

hipstersmoothie commented 4 years ago

That should be simple to implement I think

hipstersmoothie commented 4 years ago

PRs welcome! I'll probably wait until 6.0 to make that change myself, but I'm open to someone else doing it

tskarhed commented 4 years ago

Docs will have separate theming in 6.0, might fix this problem? https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#docs-theme-separated

hipstersmoothie commented 4 years ago

It isn’t dynamic yet https://github.com/storybookjs/storybook/issues/10523

sebastienbarre commented 1 year ago

I know it's been a while, but does it still mean that the Docs panel/addon cannot be made to switch from dark to light dynamically like the rest of the UI? Thanks.

hipstersmoothie commented 1 year ago

In my case I use this plugin's dark/light class to add my own dark mode overrides to the docs tab. no official support yet