signal-desktop/ts/components/conversation/SafetyNumberNotification.stories.tsx

67 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
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import type { ContactType, Props } from './SafetyNumberNotification';
import { SafetyNumberNotification } from './SafetyNumberNotification';
const i18n = setupI18n('en', enMessages);
const createContact = (props: Partial<ContactType>): ContactType => ({
id: '',
title: props.title ?? '',
});
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Conversation/SafetyNumberNotification',
argTypes: {
isGroup: { control: { type: 'boolean' } },
},
args: {
i18n,
contact: {} as ContactType,
isGroup: false,
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
},
} satisfies Meta<Props>;
export function GroupConversation(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: 'Mr. Fire',
})}
/>
);
2022-11-18 00:45:19 +00:00
}
export function DirectConversation(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: 'Mr. Fire',
})}
/>
);
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
export function LongNameInGroup(args: Props): JSX.Element {
return (
<SafetyNumberNotification
{...args}
isGroup
contact={createContact({
title: '🐈‍⬛🍕🎂'.repeat(50),
})}
/>
);
}