- add Timestamp component with moment relative time and ISO tooltip - add Timestamp stories (JustNow, MinutesAgo, HoursAgo, DaysAgo, MonthsAgo) - add ESLint 10 with typescript-eslint, react-hooks, react-refresh, prettier - add Prettier config with singleQuote, semi, trailingComma all, printWidth 100 - add lint, lint:fix, format, test:storybook scripts to package.json - fix react-hooks/set-state-in-effect in all page components - auto-fix 113 Prettier formatting issues across src and .storybook
46 lines
1.0 KiB
TypeScript
46 lines
1.0 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: {
|
|
test: 'todo',
|
|
},
|
|
},
|
|
};
|
|
|
|
export default preview;
|