2020-10-30 17:35:07 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { ScrollView } from 'react-native';
|
|
|
|
|
|
|
|
import * as List from '../../containers/List';
|
2022-04-07 14:10:03 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
2022-08-19 19:53:40 +00:00
|
|
|
import { ThemeContext, TSupportedThemes } from '../../theme';
|
|
|
|
import Item, { IItem } from './Item';
|
2020-10-30 17:35:07 +00:00
|
|
|
|
|
|
|
const author = {
|
|
|
|
_id: 'userid',
|
|
|
|
username: 'rocket.cat',
|
|
|
|
name: 'Rocket Cat'
|
|
|
|
};
|
|
|
|
const date = new Date(2020, 10, 10, 10);
|
2021-09-13 20:41:05 +00:00
|
|
|
const longText =
|
|
|
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
|
2020-10-30 17:35:07 +00:00
|
|
|
const defaultItem = {
|
|
|
|
msg: 'Message content',
|
|
|
|
tcount: 1,
|
|
|
|
replies: [1],
|
|
|
|
ts: date,
|
|
|
|
tlm: date,
|
|
|
|
u: author,
|
|
|
|
attachments: []
|
|
|
|
};
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export default {
|
|
|
|
title: 'ThreadMessagesView/Item',
|
|
|
|
decorators: [
|
|
|
|
(Story: any) => (
|
|
|
|
<ScrollView>
|
|
|
|
<List.Separator />
|
|
|
|
<Story />
|
|
|
|
<List.Separator />
|
|
|
|
</ScrollView>
|
|
|
|
)
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
const BaseItem = ({
|
|
|
|
item,
|
|
|
|
useRealName = false,
|
|
|
|
badgeColor
|
|
|
|
}: {
|
|
|
|
item?: any;
|
|
|
|
useRealName?: IItem['useRealName'];
|
|
|
|
badgeColor?: IItem['badgeColor'];
|
|
|
|
}) => (
|
2020-10-30 17:35:07 +00:00
|
|
|
<Item
|
|
|
|
item={{
|
|
|
|
...defaultItem,
|
|
|
|
...item
|
|
|
|
}}
|
2022-08-19 19:53:40 +00:00
|
|
|
useRealName={useRealName}
|
|
|
|
badgeColor={badgeColor}
|
|
|
|
user={{ id: 'abc' }}
|
|
|
|
toggleFollowThread={() => alert('toggleFollowThread')}
|
2020-10-30 17:35:07 +00:00
|
|
|
onPress={() => alert('pressed')}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Content = () => (
|
2020-10-30 17:35:07 +00:00
|
|
|
<>
|
|
|
|
<BaseItem />
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
msg: longText
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
tcount: 1000,
|
|
|
|
replies: [...new Array(1000)]
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
msg: '',
|
|
|
|
attachments: [{ title: 'Attachment title' }]
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<BaseItem useRealName />
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 17:35:07 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Badge = () => (
|
2020-10-30 17:35:07 +00:00
|
|
|
<>
|
2021-09-13 20:41:05 +00:00
|
|
|
<BaseItem badgeColor={themes.light.mentionMeColor} />
|
2020-10-30 17:35:07 +00:00
|
|
|
<List.Separator />
|
2021-09-13 20:41:05 +00:00
|
|
|
<BaseItem badgeColor={themes.light.mentionGroupColor} />
|
2020-10-30 17:35:07 +00:00
|
|
|
<List.Separator />
|
2021-09-13 20:41:05 +00:00
|
|
|
<BaseItem badgeColor={themes.light.tunreadColor} />
|
2020-10-30 17:35:07 +00:00
|
|
|
<BaseItem
|
|
|
|
item={{
|
|
|
|
msg: longText
|
|
|
|
}}
|
2020-12-17 17:39:45 +00:00
|
|
|
badgeColor={themes.light.tunreadColor}
|
2020-10-30 17:35:07 +00:00
|
|
|
/>
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 17:35:07 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
const ThemeStory = ({ theme }: { theme: TSupportedThemes }) => (
|
|
|
|
<ThemeContext.Provider value={{ theme, colors: themes[theme] }}>
|
2021-09-13 20:41:05 +00:00
|
|
|
<BaseItem badgeColor={themes[theme].mentionMeColor} />
|
2020-10-30 17:35:07 +00:00
|
|
|
</ThemeContext.Provider>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Themes = () => (
|
2020-10-30 17:35:07 +00:00
|
|
|
<>
|
|
|
|
<ThemeStory theme='light' />
|
|
|
|
<ThemeStory theme='dark' />
|
|
|
|
<ThemeStory theme='black' />
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|