|
| 1 | +import React from 'react' |
| 2 | +import type { Meta, StoryObj } from 'storybook' |
| 3 | + |
| 4 | +import Chip from 'components/base/Chip' |
| 5 | + |
| 6 | +const meta: Meta<typeof Chip> = { |
| 7 | + args: { children: 'Production' }, |
| 8 | + component: Chip, |
| 9 | + parameters: { |
| 10 | + docs: { |
| 11 | + description: { |
| 12 | + component: |
| 13 | + 'Canonical token-based chip primitive: a small labelled pill token. Layout via Bootstrap utilities, colour/radius via token utilities, padding/sizes/border/truncation in SCSS. Leading/trailing icons go in as children. Selection lives in ToggleChip and count badges are a separate Badge concern. The legacy `.chip` (old SCSS vars + manual dark-mode block, ~35×) migrates onto this under #6606.', |
| 14 | + }, |
| 15 | + }, |
| 16 | + layout: 'centered', |
| 17 | + }, |
| 18 | + title: 'Components/Data Display/Chip', |
| 19 | +} |
| 20 | +export default meta |
| 21 | + |
| 22 | +type Story = StoryObj<typeof Chip> |
| 23 | + |
| 24 | +export const Neutral: Story = {} |
| 25 | + |
| 26 | +export const Accent: Story = { |
| 27 | + args: { children: '"hello"', variant: 'accent' }, |
| 28 | +} |
| 29 | + |
| 30 | +export const Sizes: Story = { |
| 31 | + render: () => ( |
| 32 | + <div className='d-flex align-items-center gap-2'> |
| 33 | + <Chip size='default'>Default</Chip> |
| 34 | + <Chip size='sm'>Small</Chip> |
| 35 | + <Chip size='xs'>Extra small</Chip> |
| 36 | + </div> |
| 37 | + ), |
| 38 | +} |
| 39 | + |
| 40 | +export const Removable: Story = { |
| 41 | + args: { children: 'feature-flag', onRemove: () => undefined }, |
| 42 | +} |
| 43 | + |
| 44 | +export const Truncated: Story = { |
| 45 | + args: { |
| 46 | + children: '{ "test": "testvalue-that-keeps-going-and-going" }', |
| 47 | + truncate: true, |
| 48 | + variant: 'accent', |
| 49 | + }, |
| 50 | +} |
| 51 | + |
| 52 | +export const Group: Story = { |
| 53 | + render: () => ( |
| 54 | + <div className='d-flex flex-wrap gap-2'> |
| 55 | + <Chip>Development</Chip> |
| 56 | + <Chip variant='accent'>Staging</Chip> |
| 57 | + <Chip onRemove={() => undefined}>Production</Chip> |
| 58 | + </div> |
| 59 | + ), |
| 60 | +} |
0 commit comments