Migrate LastSeenIndicator to Storybook
This commit is contained in:
parent
15e817c3e2
commit
58db34c5e8
3 changed files with 33 additions and 16 deletions
|
@ -1,15 +0,0 @@
|
||||||
### One
|
|
||||||
|
|
||||||
```jsx
|
|
||||||
<util.ConversationContext theme={util.theme} ios={util.ios}>
|
|
||||||
<LastSeenIndicator count={1} i18n={util.i18n} />
|
|
||||||
</util.ConversationContext>
|
|
||||||
```
|
|
||||||
|
|
||||||
### More than one
|
|
||||||
|
|
||||||
```jsx
|
|
||||||
<util.ConversationContext theme={util.theme} ios={util.ios}>
|
|
||||||
<LastSeenIndicator count={2} i18n={util.i18n} />
|
|
||||||
</util.ConversationContext>
|
|
||||||
```
|
|
32
ts/components/conversation/LastSeenIndicator.stories.tsx
Normal file
32
ts/components/conversation/LastSeenIndicator.stories.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { number } from '@storybook/addon-knobs';
|
||||||
|
import { storiesOf } from '@storybook/react';
|
||||||
|
|
||||||
|
import { LastSeenIndicator, Props } from './LastSeenIndicator';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { setup as setupI18n } from '../../../js/modules/i18n';
|
||||||
|
// @ts-ignore
|
||||||
|
import enMessages from '../../../_locales/en/messages.json';
|
||||||
|
const i18n = setupI18n('en', enMessages);
|
||||||
|
|
||||||
|
const story = storiesOf('Components/Conversation/LastSeenIndicator', module);
|
||||||
|
|
||||||
|
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
||||||
|
count: number('count', overrideProps.count || 1),
|
||||||
|
i18n,
|
||||||
|
});
|
||||||
|
|
||||||
|
story.add('One', () => {
|
||||||
|
const props = createProps();
|
||||||
|
return <LastSeenIndicator {...props} />;
|
||||||
|
});
|
||||||
|
|
||||||
|
story.add('More than One', () => {
|
||||||
|
const props = createProps({
|
||||||
|
count: 5,
|
||||||
|
});
|
||||||
|
|
||||||
|
return <LastSeenIndicator {...props} />;
|
||||||
|
});
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
|
|
||||||
import { LocalizerType } from '../../types/Util';
|
import { LocalizerType } from '../../types/Util';
|
||||||
|
|
||||||
type Props = {
|
export type Props = {
|
||||||
count: number;
|
count: number;
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue