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

71 lines
1.6 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 { 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);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/ConfirmationDialog',
};
export const _ConfirmationDialog = (): JSX.Element => {
return (
<ConfirmationDialog
2022-09-27 20:24:21 +00:00
dialogName="test"
2022-06-07 00:48:02 +00:00
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>
);
};
_ConfirmationDialog.story = {
name: 'ConfirmationDialog',
};
export const CustomCancelText = (): JSX.Element => {
return (
<ConfirmationDialog
2022-09-27 20:24:21 +00:00
dialogName="test"
2022-06-07 00:48:02 +00:00
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>
);
};
CustomCancelText.story = {
name: 'Custom cancel text',
};