45 lines
956 B
TypeScript
45 lines
956 B
TypeScript
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
|