dimensionlab-ui/.storybook/preview.ts

51 lines
1.2 KiB
TypeScript

import "../src/styles.css";
import type { Preview } from "@storybook/react-vite";
const preview: Preview = {
decorators: [
(Story, context) => {
const theme = context.globals.theme === "light" ? "light" : "dark";
if (typeof document !== "undefined") {
document.documentElement.setAttribute("data-ui-theme", theme);
}
return Story();
},
],
globalTypes: {
theme: {
description: "Dashboard component theme",
defaultValue: "dark",
toolbar: {
title: "Theme",
icon: "circlehollow",
items: [
{ value: "dark", title: "Dark" },
{ value: "light", title: "Light" },
],
dynamicTitle: true,
},
},
},
parameters: {
backgrounds: {
default: "canvas",
values: [
{ name: "canvas", value: "#0b0f0d" },
{ name: "raised", value: "#151d18" },
{ name: "light canvas", value: "#eef2e7" },
{ name: "light raised", value: "#f1f5ea" },
],
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
layout: "fullscreen",
},
};
export default preview;