inspector/clients/web/.storybook/preview.tsx
cliffhall 46dd1b09ca fix dark mode, storybook config, and minor UI issues
- Add color scheme toggle to Storybook preview via globalTypes
- Remove @storybook/addon-actions (built into Storybook 9+)
- Include .storybook/ files in tsconfig.storybook.json
- Fix InlineError show more button color for readability
- Use transparent variant on Remove button for consistent red in dark mode

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:12:37 -04:00

68 lines
1.6 KiB
TypeScript

import type { Preview } from '@storybook/react-vite'
import { MantineProvider, useMantineColorScheme } from '@mantine/core'
import { Notifications } from '@mantine/notifications'
import '@mantine/core/styles.css'
import '@mantine/notifications/styles.css'
import '../src/App.css'
import { theme } from '../src/theme/theme'
import { useEffect } from 'react'
function ColorSchemeWrapper({
colorScheme,
children,
}: {
colorScheme: 'light' | 'dark'
children: React.ReactNode
}) {
const { setColorScheme } = useMantineColorScheme()
useEffect(() => {
setColorScheme(colorScheme)
}, [colorScheme, setColorScheme])
return <>{children}</>
}
const preview: Preview = {
globalTypes: {
colorScheme: {
description: 'Mantine color scheme',
toolbar: {
title: 'Color Scheme',
icon: 'mirror',
items: [
{ value: 'light', title: 'Light', icon: 'sun' },
{ value: 'dark', title: 'Dark', icon: 'moon' },
],
dynamicTitle: true,
},
},
},
initialGlobals: {
colorScheme: 'light',
},
decorators: [
(Story, context) => (
<MantineProvider theme={theme} defaultColorScheme="light">
<ColorSchemeWrapper colorScheme={context.globals.colorScheme ?? 'light'}>
<Notifications position="top-right" />
<Story />
</ColorSchemeWrapper>
</MantineProvider>
),
],
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
a11y: {
test: 'todo',
},
layout: 'centered',
},
}
export default preview