react-spectrum
5f3eb1cc - fix(sb10): wire dark/light mode switching in .storybook (v3/rac) preview

Commit
126 days ago
fix(sb10): wire dark/light mode switching in .storybook (v3/rac) preview The @vueless/storybook-dark-mode toolbar toggle was a no-op in the v3/rac Storybook because nothing in .storybook reacted to its DARK_MODE event. - preview.js: subscribe to DARK_MODE_EVENT_NAME on the addons channel and reflect the state on document.documentElement.dataset.colorScheme. Initial value reads from the addon's `sb-addon-themes-3` localStorage key so the first paint is correct (matches the .storybook-s2 pattern). - custom-addons/provider/index.js: consume useDarkMode() and feed isDark through to the React Spectrum Provider's `colorScheme` prop whenever the ProviderSwitcher dropdown is set to "Auto". An explicit dropdown choice still wins.
Author
Parents
Loading