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

56 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-01-03 19:55:46 +00:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 20:34:04 +00:00
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
2021-08-24 20:59:44 +00:00
import { DialogRelink } from './DialogRelink';
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';
import { WidthBreakpoint } from './_util';
import { FakeLeftPaneContainer } from '../test-both/helpers/FakeLeftPaneContainer';
2020-09-12 00:46:52 +00:00
const i18n = setupI18n('en', enMessages);
const defaultProps = {
containerWidthBreakpoint: WidthBreakpoint.Wide,
i18n,
relinkDevice: action('relink-device'),
};
const permutations = [
{
title: 'Unlinked (wide container)',
props: {
containerWidthBreakpoint: WidthBreakpoint.Wide,
},
},
{
title: 'Unlinked (narrow container)',
props: {
containerWidthBreakpoint: WidthBreakpoint.Narrow,
},
},
];
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/DialogRelink',
};
2022-11-18 00:45:19 +00:00
export function Iterations(): JSX.Element {
2022-06-07 00:48:02 +00:00
return (
<>
{permutations.map(({ props, title }) => (
<>
<h3>{title}</h3>
<FakeLeftPaneContainer
containerWidthBreakpoint={props.containerWidthBreakpoint}
>
<DialogRelink {...defaultProps} {...props} />
</FakeLeftPaneContainer>
</>
))}
</>
);
2022-11-18 00:45:19 +00:00
}