= {
component: Button,
argTypes: {
variant: { control: 'select', options: ['primary', 'secondary'] },
size: { control: 'radio', options: ['sm', 'md', 'lg'] }
}
}
export const Playground: Story = { args: { variant: 'primary', children: 'Click' } }
export const AllVariants: Story = {
render: () => (
{(['primary', 'secondary', 'ghost'] as const).map(v => (
))}
)
}
```
## Visual Regression Testing
```typescript
// Chromatic veya Percy ile
test('Button variants match snapshot', async ({ page }) => {
await page.goto('/iframe.html?id=button--all-variants')
await expect(page).toHaveScreenshot('button-variants.png', {
maxDiffPixelRatio: 0.01
})
})
```
## Theming
```css
/* CSS Custom Properties */
:root {
--color-primary: #3b82f6;
--color-bg: #ffffff;
--color-text: #1f2937;
}
[data-theme="dark"] {
--color-primary: #60a5fa;
--color-bg: #111827;
--color-text: #f9fafb;
}
```
## Checklist
- [ ] Design tokens single source of truth
- [ ] Component API composition-based (slot pattern)
- [ ] Her component'te Storybook story var
- [ ] Visual regression test aktif
- [ ] Accessibility: keyboard nav + ARIA + contrast
- [ ] Theming: CSS variables ile dark/light
- [ ] Semantic versioning + CHANGELOG
- [ ] Prop documentation (JSDoc veya MDX)
- [ ] Bundle size per-component tracked
## Anti-Patterns
- Prop explosion (10+ prop → composition kullan)
- Token'sız hardcoded değerler
- Component'te global CSS
- Story'siz component
- Theme switch'te flash (FOUC)
- Circular dependency between components