2021-09-16 16:15:43 +00:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-26 18:40:23 +00:00
|
|
|
import * as React from 'react';
|
2020-09-14 19:51:27 +00:00
|
|
|
import { boolean } from '@storybook/addon-knobs';
|
2020-08-26 18:40:23 +00:00
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
|
2021-09-18 00:30:08 +00:00
|
|
|
import { setupI18n } from '../../util/setupI18n';
|
2020-08-26 18:40:23 +00:00
|
|
|
import enMessages from '../../../_locales/en/messages.json';
|
|
|
|
import { Props, VerificationNotification } from './VerificationNotification';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
const story = storiesOf(
|
|
|
|
'Components/Conversation/VerificationNotification',
|
|
|
|
module
|
|
|
|
);
|
|
|
|
|
2021-09-16 16:15:43 +00:00
|
|
|
const contact = { title: 'Mr. Fire' };
|
2020-08-26 18:40:23 +00:00
|
|
|
|
|
|
|
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|
|
|
i18n,
|
|
|
|
type: overrideProps.type || 'markVerified',
|
|
|
|
isLocal: boolean('isLocal', overrideProps.isLocal !== false),
|
2021-09-02 21:23:27 +00:00
|
|
|
contact: overrideProps.contact || contact,
|
2020-08-26 18:40:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Mark as Verified', () => {
|
|
|
|
const props = createProps({ type: 'markVerified' });
|
|
|
|
|
|
|
|
return <VerificationNotification {...props} />;
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Mark as Not Verified', () => {
|
|
|
|
const props = createProps({ type: 'markNotVerified' });
|
|
|
|
|
|
|
|
return <VerificationNotification {...props} />;
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Mark as Verified Remotely', () => {
|
|
|
|
const props = createProps({ type: 'markVerified', isLocal: false });
|
|
|
|
|
|
|
|
return <VerificationNotification {...props} />;
|
|
|
|
});
|
|
|
|
|
|
|
|
story.add('Mark as Not Verified Remotely', () => {
|
|
|
|
const props = createProps({ type: 'markNotVerified', isLocal: false });
|
|
|
|
|
|
|
|
return <VerificationNotification {...props} />;
|
|
|
|
});
|
2021-09-02 21:23:27 +00:00
|
|
|
|
|
|
|
story.add('Long name', () => {
|
|
|
|
const longName = '🎆🍬🏈'.repeat(50);
|
|
|
|
|
|
|
|
const props = createProps({
|
|
|
|
type: 'markVerified',
|
2021-09-16 16:15:43 +00:00
|
|
|
contact: { title: longName },
|
2021-09-02 21:23:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
return <VerificationNotification {...props} />;
|
|
|
|
});
|