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

81 lines
2 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';
2020-09-14 19:51:27 +00:00
import { boolean } from '@storybook/addon-knobs';
2021-09-18 00:30:08 +00:00
import { setupI18n } from '../../util/setupI18n';
import enMessages from '../../../_locales/en/messages.json';
import type { Props } from './VerificationNotification';
import { VerificationNotification } from './VerificationNotification';
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/Conversation/VerificationNotification',
};
const contact = { title: 'Mr. Fire' };
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
i18n,
type: overrideProps.type || 'markVerified',
isLocal: boolean('isLocal', overrideProps.isLocal !== false),
contact: overrideProps.contact || contact,
});
2022-11-18 00:45:19 +00:00
export function MarkAsVerified(): JSX.Element {
const props = createProps({ type: 'markVerified' });
return <VerificationNotification {...props} />;
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MarkAsVerified.story = {
name: 'Mark as Verified',
};
2022-11-18 00:45:19 +00:00
export function MarkAsNotVerified(): JSX.Element {
const props = createProps({ type: 'markNotVerified' });
return <VerificationNotification {...props} />;
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MarkAsNotVerified.story = {
name: 'Mark as Not Verified',
};
2022-11-18 00:45:19 +00:00
export function MarkAsVerifiedRemotely(): JSX.Element {
const props = createProps({ type: 'markVerified', isLocal: false });
return <VerificationNotification {...props} />;
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MarkAsVerifiedRemotely.story = {
name: 'Mark as Verified Remotely',
};
2022-11-18 00:45:19 +00:00
export function MarkAsNotVerifiedRemotely(): JSX.Element {
const props = createProps({ type: 'markNotVerified', isLocal: false });
return <VerificationNotification {...props} />;
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
MarkAsNotVerifiedRemotely.story = {
name: 'Mark as Not Verified Remotely',
};
2022-11-18 00:45:19 +00:00
export function LongName(): JSX.Element {
const longName = '🎆🍬🏈'.repeat(50);
const props = createProps({
type: 'markVerified',
contact: { title: longName },
});
return <VerificationNotification {...props} />;
2022-11-18 00:45:19 +00:00
}
2022-06-07 00:48:02 +00:00
LongName.story = {
name: 'Long name',
};