Migrate Typing/Unsupported/Verification components to Storybook
This commit is contained in:
parent
58844f92ab
commit
45b9bbc837
12 changed files with 217 additions and 183 deletions
45
ts/components/conversation/TypingBubble.stories.tsx
Normal file
45
ts/components/conversation/TypingBubble.stories.tsx
Normal file
|
@ -0,0 +1,45 @@
|
|||
import * as React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { select, text } from '@storybook/addon-knobs';
|
||||
|
||||
// @ts-ignore
|
||||
import { setup as setupI18n } from '../../../js/modules/i18n';
|
||||
|
||||
// @ts-ignore
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
|
||||
import { Props, TypingBubble } from './TypingBubble';
|
||||
import { Colors } from '../../types/Colors';
|
||||
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
const story = storiesOf('Components/Conversation/TypingBubble', module);
|
||||
|
||||
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||
i18n,
|
||||
color: select(
|
||||
'color',
|
||||
Colors.reduce((m, c) => ({ ...m, [c]: c }), {}),
|
||||
overrideProps.color || 'red'
|
||||
),
|
||||
avatarPath: text('avatarPath', overrideProps.avatarPath || ''),
|
||||
title: '',
|
||||
profileName: text('profileName', overrideProps.profileName || ''),
|
||||
conversationType: select(
|
||||
'conversationType',
|
||||
{ group: 'group', direct: 'direct' },
|
||||
overrideProps.conversationType || 'direct'
|
||||
),
|
||||
});
|
||||
|
||||
story.add('Direct', () => {
|
||||
const props = createProps();
|
||||
|
||||
return <TypingBubble {...props} />;
|
||||
});
|
||||
|
||||
story.add('Group', () => {
|
||||
const props = createProps({ conversationType: 'group' });
|
||||
|
||||
return <TypingBubble {...props} />;
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue