// // Copyright 2022 DXOS.org // import { type Meta, type StoryObj } from '@storybook/react-vite'; import React from 'react'; import { random } from '@dxos/random'; import { type MessageValence } from '@dxos/ui-types'; import { withTheme } from '../../testing'; import { Button } from '../Button'; import { Message } from './Message'; random.seed(123); type StoryArgs = { valence: MessageValence; title: string; body: string; button?: boolean; }; const DefaultStory = ({ valence, title, body, button }: StoryArgs) => (
{title && console.log('close')}>{title}} {body && (

{body}

{button && }
)}
); const meta = { title: 'ui/react-ui-core/components/Message', component: Message.Root as any, render: DefaultStory, decorators: [withTheme()], parameters: { layout: 'centered', }, argTypes: { valence: { control: 'select', options: ['success', 'info', 'warning', 'error', 'neutral'], }, }, } satisfies Meta; export default meta; type Story = StoryObj; export const Default: Story = { args: { valence: 'neutral', title: 'Default', body: random.lorem.paragraphs(1), button: true, }, }; export const Success: Story = { args: { valence: 'success', title: 'Success', body: random.lorem.paragraphs(1), button: true, }, }; export const Info: Story = { args: { valence: 'info', title: 'Info', body: random.lorem.paragraphs(1), button: true, }, }; export const Warning: Story = { args: { valence: 'warning', title: 'Warning', body: random.lorem.paragraphs(1), button: true, }, }; export const Error: Story = { args: { valence: 'error', title: 'Error', body: random.lorem.paragraphs(1), button: true, }, };