register.ts 394 B

123456789101112
  1. import { addons, types } from "storybook/manager-api";
  2. import { ADDON_ID, TOOL_ID } from "./constants";
  3. import { ThemeTool } from "./theme-toggle";
  4. addons.register(ADDON_ID, () => {
  5. addons.add(TOOL_ID, {
  6. type: types.TOOL,
  7. title: "Toggle Theme",
  8. match: ({ tabId, viewMode }: any) => !tabId && (viewMode === "story" || viewMode === "docs"),
  9. render: ThemeTool,
  10. } as any);
  11. });