signal-desktop/ts/components/Toast.stories.tsx
Jamie Kyle 502ea174ab
Upgrade Storybook
Co-authored-by: Scott Nonnenberg <scott@signal.org>
2023-10-11 12:06:43 -07:00

52 lines
1.5 KiB
TypeScript

// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { PropsType } from './Toast';
import { Toast } from './Toast';
import { type ComponentMeta, argPresets } from '../storybook/types';
export default {
title: 'Components/Toast',
component: Toast,
argTypes: {
autoDismissDisabled: { control: { type: 'boolean' } },
className: { control: { type: 'string' } },
children: { control: { type: 'string' } },
timeout: argPresets({
'1s': 1000,
'30s': 30_000,
}),
toastAction: argPresets({
None: undefined,
Dismiss: { label: 'Dismiss', onClick: action('onClick') },
Undo: { label: 'Undo', onClick: action('onClick') },
}),
},
args: {
autoDismissDisabled: undefined,
className: undefined,
children: 'This is a toast',
disableCloseOnClick: undefined,
onClose: action('onClose'),
style: undefined,
timeout: undefined,
toastAction: undefined,
},
} satisfies ComponentMeta<PropsType>;
export function Defaults(args: PropsType): JSX.Element {
return <Toast {...args} />;
}
export function Long(args: PropsType): JSX.Element {
return (
<Toast {...args}>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis deserunt
cupiditate doloribus vitae perspiciatis, eos atque mollitia aliquam quae
aspernatur et iure vero illo veritatis quibusdam maiores laborum.
Inventore, minus.
</Toast>
);
}