import type { Meta, StoryObj } from '@storybook/react-vite' import { IconPencilMinus, IconUserPlus } from '@tabler/icons-react' import { Banner } from './Banner' const meta = { title: 'Feedback/Banner', component: Banner, parameters: { layout: 'fullscreen', // axe color-contrast is off here until PLAN.md stage 0.10 is ruled: // the info tone reads 3.99:1 on its wash in ship (AA 4.5:1). a11y: { config: { rules: [{ id: 'color-contrast', enabled: false }] } }, }, args: { tone: 'ok', children: 'Public key copied.' }, argTypes: { tone: { control: 'inline-radio', options: ['ok', 'error', 'info', 'warning'] } }, } satisfies Meta export default meta type Story = StoryObj export const Ok: Story = {} /** An error announces itself (`role="alert"`); the rest are polite. */ export const Error: Story = { args: { tone: 'error', children: 'The last read failed — reconnecting.' } } export const Info: Story = { args: { tone: 'info', children: 'A new version is available. Reload when convenient.' } } export const Warning: Story = { args: { tone: 'warning', children: 'This workspace is read-only until sign-in.' } } /** * With a dismiss (D21). The row is 40px rather than 36px, because the button * is taller than the line of text. */ export const Dismissible: Story = { args: { tone: 'warning', children: 'This workspace is read-only until sign-in.', onDismiss: () => {} }, } /** * With an icon and one action (Katerina, 2026-09-18). One line: the text * truncates, and the Button stays at the end. */ export const WithIconAndAction: Story = { parameters: { controls: { disable: true } }, render: () => (
} action={{ label: 'Invite people', onClick: () => {} }}> This is the start of the conversation in Project Alpha }> This is the start of your conversation with Sam Lee } action={{ label: 'Join', onClick: () => {} }}> You are not in Project Alpha yet — join to take part in the conversation
), } /** All four tones, stacked. */ export const AllTones: Story = { parameters: { controls: { disable: true } }, render: () => (
Public key copied. A new version is available. Reload when convenient. This workspace is read-only until sign-in. The last read failed — reconnecting.
), } /** The same four with a dismiss, so the two heights can be compared. */ export const AllTonesDismissible: Story = { parameters: { controls: { disable: true } }, render: () => (
{}}> Public key copied. {}}> A new version is available. Reload when convenient. {}}> This workspace is read-only until sign-in. {}}> The last read failed — reconnecting.
), }