storybook-theme-css-vars
Version:
Theme switcher tool addon that changes the theme using CSS custom properties
14 lines • 447 B
JavaScript
import { addons, types } from "@storybook/addons";
import { ADDON_ID, TOOL_ID } from "../constants";
import { ThemeSwitcher } from "../theme/ThemeSwitcher";
addons.register(ADDON_ID, function () {
addons.add(TOOL_ID, {
type: types.TOOL,
title: "Theme switcher",
match: function match(_ref) {
var viewMode = _ref.viewMode;
return !!(viewMode && viewMode.match(/^(story|docs)$/));
},
render: ThemeSwitcher
});
});