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')}
|
2022-11-02 00:10:27 +00:00
|
|
|
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'),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
2022-11-02 00:10:27 +00:00
|
|
|
asdf blip
|
2022-06-07 00:48:02 +00:00
|
|
|
</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')}
|
2022-11-02 00:10:27 +00:00
|
|
|
title="Maybs?"
|
2022-06-07 00:48:02 +00:00
|
|
|
actions={[
|
|
|
|
{
|
|
|
|
text: 'Maybe',
|
|
|
|
style: 'affirmative',
|
|
|
|
action: action('affirmative'),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
>
|
2022-11-02 00:10:27 +00:00
|
|
|
Because.
|
2022-06-07 00:48:02 +00:00
|
|
|
</ConfirmationDialog>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
CustomCancelText.story = {
|
|
|
|
name: 'Custom cancel text',
|
|
|
|
};
|
2022-11-02 00:10:27 +00:00
|
|
|
|
|
|
|
export const 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>
|
|
|
|
);
|
|
|
|
};
|