2022-02-28 18:00:47 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ScrollView } from 'react-native';
|
|
|
|
|
|
|
|
import * as List from '../../containers/List';
|
2022-08-19 19:53:40 +00:00
|
|
|
import { colors } from '../../lib/constants';
|
|
|
|
import { ThemeContext, TSupportedThemes } from '../../theme';
|
|
|
|
import Item, { IItem } from './Item';
|
2022-02-28 18:00:47 +00:00
|
|
|
|
|
|
|
const author = {
|
|
|
|
_id: 'userid',
|
|
|
|
username: 'rocket.cat',
|
|
|
|
name: 'Rocket Cat'
|
|
|
|
};
|
|
|
|
const date = new Date(2020, 10, 10, 10);
|
|
|
|
const longText =
|
|
|
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
|
|
|
|
const defaultItem = {
|
|
|
|
msg: 'Message content',
|
|
|
|
tcount: 1,
|
|
|
|
replies: [1],
|
|
|
|
ts: date,
|
|
|
|
tlm: date,
|
|
|
|
u: author,
|
|
|
|
attachments: []
|
2022-08-19 19:53:40 +00:00
|
|
|
} as unknown as IItem['item'];
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'DiscussionsView/Item',
|
|
|
|
decorators: [
|
|
|
|
(Story: any) => (
|
|
|
|
<ScrollView>
|
|
|
|
<List.Separator />
|
|
|
|
<Story />
|
|
|
|
<List.Separator />
|
|
|
|
</ScrollView>
|
|
|
|
)
|
|
|
|
]
|
2022-02-28 18:00:47 +00:00
|
|
|
};
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
const BaseItem = ({ item }: { item?: Partial<IItem['item']> }) => (
|
2022-02-28 18:00:47 +00:00
|
|
|
<Item
|
|
|
|
item={{
|
|
|
|
...defaultItem,
|
|
|
|
...item
|
|
|
|
}}
|
|
|
|
onPress={() => alert('pressed')}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Content = () => (
|
2022-02-28 18:00:47 +00:00
|
|
|
<>
|
|
|
|
<BaseItem />
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
msg: longText
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
2022-08-19 19:53:40 +00:00
|
|
|
dcount: 1000
|
2022-02-28 18:00:47 +00:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
msg: '',
|
|
|
|
attachments: [{ title: 'Attachment title' }]
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
2022-08-19 19:53:40 +00:00
|
|
|
{/* @ts-ignore: FIXME: useRealName is not working */}
|
2022-02-28 18:00:47 +00:00
|
|
|
<BaseItem useRealName />
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2022-02-28 18:00:47 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
const ThemeStory = ({ theme }: { theme: TSupportedThemes }) => (
|
2022-05-30 22:02:08 +00:00
|
|
|
<ThemeContext.Provider value={{ theme, colors: colors[theme] }}>
|
2022-08-19 19:53:40 +00:00
|
|
|
<BaseItem />
|
2022-02-28 18:00:47 +00:00
|
|
|
</ThemeContext.Provider>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Themes = () => (
|
2022-02-28 18:00:47 +00:00
|
|
|
<>
|
|
|
|
<ThemeStory theme='light' />
|
|
|
|
<ThemeStory theme='dark' />
|
|
|
|
<ThemeStory theme='black' />
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|