design system token v0.1
This commit is contained in:
44
.storybook/preview.ts
Normal file
44
.storybook/preview.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { Preview } from '@storybook/nextjs-vite'
|
||||
import '../app/globals.css'
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/i,
|
||||
},
|
||||
},
|
||||
a11y: {
|
||||
test: 'todo',
|
||||
},
|
||||
backgrounds: { disable: true },
|
||||
},
|
||||
globalTypes: {
|
||||
theme: {
|
||||
description: 'Theme',
|
||||
toolbar: {
|
||||
title: 'Theme',
|
||||
icon: 'paintbrush',
|
||||
items: [
|
||||
{ value: 'light', title: 'Light', icon: 'sun' },
|
||||
{ value: 'dark', title: 'Dark', icon: 'moon' },
|
||||
],
|
||||
dynamicTitle: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
initialGlobals: {
|
||||
theme: 'light',
|
||||
},
|
||||
decorators: [
|
||||
(Story, context) => {
|
||||
const theme = context.globals.theme || 'light'
|
||||
document.documentElement.classList.remove('light', 'dark')
|
||||
document.documentElement.classList.add(theme)
|
||||
return Story()
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export default preview
|
||||
Reference in New Issue
Block a user