2020-10-30 16:15:58 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { View } from 'react-native';
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
import { themes } from '../../lib/constants';
|
|
|
|
import UnreadBadge from '.';
|
|
|
|
import { ThemeContext, TSupportedThemes } from '../../theme';
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export default {
|
|
|
|
title: 'Unread Badge'
|
|
|
|
};
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
const StoryTester = ({ children }: { children: React.ReactElement | React.ReactElement[] }) => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<View
|
|
|
|
style={{
|
2021-09-13 20:41:05 +00:00
|
|
|
flex: 1,
|
|
|
|
flexDirection: 'row',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'space-evenly'
|
2022-08-08 21:02:08 +00:00
|
|
|
}}
|
|
|
|
>
|
2020-10-30 16:15:58 +00:00
|
|
|
{children}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const All = () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<StoryTester>
|
|
|
|
<UnreadBadge unread={9} small />
|
|
|
|
<UnreadBadge unread={999} small />
|
|
|
|
<UnreadBadge unread={9} />
|
|
|
|
<UnreadBadge unread={9999} />
|
|
|
|
<UnreadBadge unread={9} userMentions={1} />
|
|
|
|
<UnreadBadge unread={9} groupMentions={1} />
|
|
|
|
<UnreadBadge unread={9} tunread={[1]} />
|
|
|
|
</StoryTester>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Small = () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<StoryTester>
|
|
|
|
<UnreadBadge unread={9} small />
|
|
|
|
<UnreadBadge unread={999} small />
|
|
|
|
</StoryTester>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Normal = () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<StoryTester>
|
|
|
|
<UnreadBadge unread={9} />
|
|
|
|
<UnreadBadge unread={9999} />
|
|
|
|
</StoryTester>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const DifferentMentionTypes = () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<StoryTester>
|
|
|
|
<UnreadBadge unread={1} />
|
|
|
|
<UnreadBadge unread={1} userMentions={1} />
|
|
|
|
<UnreadBadge unread={1} groupMentions={1} />
|
|
|
|
<UnreadBadge unread={1} userMentions={1} groupMentions={1} />
|
|
|
|
<UnreadBadge unread={1} tunread={[1]} />
|
|
|
|
<UnreadBadge unread={1} tunreadUser={[1]} />
|
|
|
|
<UnreadBadge unread={1} tunreadGroup={[1]} />
|
|
|
|
</StoryTester>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|
2020-10-30 16:15:58 +00:00
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
const ThemeStory = ({ theme }: { theme: TSupportedThemes }) => (
|
|
|
|
<ThemeContext.Provider value={{ theme, colors: themes[theme] }}>
|
2020-10-30 16:15:58 +00:00
|
|
|
<StoryTester>
|
|
|
|
<UnreadBadge unread={1} />
|
|
|
|
<UnreadBadge unread={1} userMentions={1} />
|
|
|
|
<UnreadBadge unread={1} groupMentions={1} />
|
|
|
|
<UnreadBadge tunread={[1]} />
|
|
|
|
</StoryTester>
|
|
|
|
</ThemeContext.Provider>
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:53:40 +00:00
|
|
|
export const Themes = () => (
|
2020-10-30 16:15:58 +00:00
|
|
|
<>
|
|
|
|
<ThemeStory theme='light' />
|
|
|
|
<ThemeStory theme='dark' />
|
|
|
|
<ThemeStory theme='black' />
|
|
|
|
</>
|
2022-08-19 19:53:40 +00:00
|
|
|
);
|