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

91 lines
1.9 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';
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="Foo bar banana baz?"
2022-06-07 00:48:02 +00:00
actions={[
{
text: 'Negate',
style: 'negative',
action: action('negative'),
},
{
text: 'Affirm',
style: 'affirmative',
action: action('affirmative'),
},
]}
>
asdf blip
2022-06-07 00:48:02 +00:00
</ConfirmationDialog>
);
};
_ConfirmationDialog.story = {
name: 'ConfirmationDialog',
};
2022-11-18 00:45:19 +00:00
export function CustomCancelText(): JSX.Element {
2022-06-07 00:48:02 +00:00
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="Maybs?"
2022-06-07 00:48:02 +00:00
actions={[
{
text: 'Maybe',
style: 'affirmative',
action: action('affirmative'),
},
]}
>
Because.
2022-06-07 00:48:02 +00:00
</ConfirmationDialog>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
CustomCancelText.story = {
name: 'Custom cancel text',
};
2022-11-18 00:45:19 +00:00
export function NoDefaultCancel(): JSX.Element {
return (
<ConfirmationDialog
dialogName="test"
noDefaultCancelButton
i18n={i18n}
onClose={action('onClose')}
title="Do you?"
actions={[
{
text: 'Yep',
style: 'affirmative',
action: action('affirmative'),
},
]}
>
No default cancel!
</ConfirmationDialog>
);
2022-11-18 00:45:19 +00:00
}