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>
This commit is contained in:
parent
3c25bdfbd5
commit
46dd1b09ca
2 changed files with 43 additions and 21 deletions
|
|
@ -7,7 +7,6 @@ const config: StorybookConfig = {
|
|||
],
|
||||
"addons": [
|
||||
"@chromatic-com/storybook",
|
||||
"@storybook/addon-actions",
|
||||
"@storybook/addon-vitest",
|
||||
"@storybook/addon-a11y",
|
||||
"@storybook/addon-docs",
|
||||
|
|
|
|||
|
|
@ -1,17 +1,53 @@
|
|||
import type { Preview } from '@storybook/react-vite'
|
||||
import { MantineProvider } from '@mantine/core'
|
||||
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) => (
|
||||
(Story, context) => (
|
||||
<MantineProvider theme={theme} defaultColorScheme="light">
|
||||
<Notifications position="top-right" />
|
||||
<Story />
|
||||
<ColorSchemeWrapper colorScheme={context.globals.colorScheme ?? 'light'}>
|
||||
<Notifications position="top-right" />
|
||||
<Story />
|
||||
</ColorSchemeWrapper>
|
||||
</MantineProvider>
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in a new issue