signal-desktop/ts/components/ConfirmationDialog.stories.tsx

58 lines
1.5 KiB
TypeScript
Raw Normal View History

2020-10-30 20:34:04 +00:00
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2020-05-27 21:37:06 +00:00
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { text } from '@storybook/addon-knobs';
2020-09-12 00:46:52 +00:00
import { ConfirmationDialog } from './ConfirmationDialog';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../util/setupI18n';
2020-09-12 00:46:52 +00:00
import enMessages from '../../_locales/en/messages.json';
2020-05-27 21:37:06 +00:00
const i18n = setupI18n('en', enMessages);
storiesOf('Components/ConfirmationDialog', module)
.add('ConfirmationDialog', () => {
2020-05-27 21:37:06 +00:00
return (
<ConfirmationDialog
i18n={i18n}
onClose={action('onClose')}
title={text('Title', 'Foo bar banana baz?')}
actions={[
{
text: 'Negate',
style: 'negative',
action: action('negative'),
},
{
text: 'Affirm',
style: 'affirmative',
action: action('affirmative'),
},
]}
>
{text('Child text', 'asdf blip')}
</ConfirmationDialog>
);
})
.add('Custom cancel text', () => {
return (
<ConfirmationDialog
cancelText="Nah"
i18n={i18n}
onClose={action('onClose')}
title={text('Title', 'Foo bar banana baz?')}
actions={[
{
text: 'Maybe',
style: 'affirmative',
action: action('affirmative'),
},
]}
>
{text('Child text', 'asdf blip')}
</ConfirmationDialog>
);
});