- add --color-primary-text for lime used as text or icon color - stop dimming the idle refresh label with opacity - darken the light danger button and lighten the dark danger hover - define syntax highlighting colors per theme as --hl-* tokens - darken light muted text slightly - add a storybook contrast page, fail storybook tests on a11y violations and show live token values in the colors story - bump version to 1.20.2
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import type { Preview } from '@storybook/react-vite';
|
|
import '../src/ui/tokens.css';
|
|
|
|
const preview: Preview = {
|
|
globalTypes: {
|
|
theme: {
|
|
name: 'Theme',
|
|
description: 'Color theme',
|
|
defaultValue: 'light',
|
|
toolbar: {
|
|
icon: 'circlehollow',
|
|
items: [
|
|
{ value: 'light', icon: 'sun', title: 'Light' },
|
|
{ value: 'dark', icon: 'moon', title: 'Dark' },
|
|
],
|
|
dynamicTitle: true,
|
|
},
|
|
},
|
|
},
|
|
decorators: [
|
|
(Story, context) => {
|
|
const theme = (context.globals['theme'] as string) ?? 'light';
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
return (
|
|
<div style={{ background: 'var(--color-bg)', minHeight: '100vh', padding: 0 }}>
|
|
<Story />
|
|
</div>
|
|
);
|
|
},
|
|
],
|
|
parameters: {
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/i,
|
|
},
|
|
},
|
|
a11y: {
|
|
// Accessibility violations (e.g. color contrast) fail the story's test
|
|
test: 'error',
|
|
},
|
|
},
|
|
};
|
|
|
|
export default preview;
|