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

55 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-01-03 11:55:46 -08:00
// Copyright 2020 Signal Messenger, LLC
2020-10-30 15:34:04 -05:00
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './DialogRelink';
2021-08-24 16:59:44 -04:00
import { DialogRelink } from './DialogRelink';
import { WidthBreakpoint } from './_util';
2025-06-26 12:24:07 -04:00
import { FakeLeftPaneContainer } from '../test-helpers/FakeLeftPaneContainer';
2020-09-11 17:46:52 -07:00
2025-03-13 12:52:08 -07:00
const { i18n } = window.SignalContext;
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-06 20:48:02 -04:00
export default {
title: 'Components/DialogRelink',
} satisfies Meta<PropsType>;
2022-06-06 20:48:02 -04:00
2022-11-17 16:45:19 -08:00
export function Iterations(): JSX.Element {
2022-06-06 20:48:02 -04:00
return (
<>
{permutations.map(({ props, title }) => (
<>
<h3>{title}</h3>
<FakeLeftPaneContainer
containerWidthBreakpoint={props.containerWidthBreakpoint}
>
<DialogRelink {...defaultProps} {...props} />
</FakeLeftPaneContainer>
</>
))}
</>
);
2022-11-17 16:45:19 -08:00
}