2021-01-20 20:43:59 +00:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions, react/prop-types */
|
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react-native';
|
|
|
|
|
|
|
|
import ServerItemComponent from '../../app/presentation/ServerItem';
|
|
|
|
import { ThemeContext } from '../../app/theme';
|
|
|
|
|
|
|
|
const stories = storiesOf('ServerItem', module);
|
|
|
|
|
|
|
|
const themes = {
|
|
|
|
light: 'light',
|
|
|
|
dark: 'dark',
|
|
|
|
black: 'black'
|
|
|
|
};
|
|
|
|
|
|
|
|
const item = {
|
|
|
|
name: 'Rocket.Chat',
|
|
|
|
id: 'https://open.rocket.chat/',
|
|
|
|
iconURL: 'https://open.rocket.chat/images/logo/android-chrome-512x512.png'
|
|
|
|
};
|
|
|
|
|
2022-03-22 13:53:09 +00:00
|
|
|
const ServerItem = ({ theme = themes.light, ...props }) => (
|
|
|
|
<ThemeContext.Provider
|
|
|
|
value={{
|
|
|
|
theme,
|
|
|
|
themePreferences: {
|
|
|
|
currentTheme: theme,
|
|
|
|
darkLevel: theme
|
|
|
|
}
|
|
|
|
}}>
|
|
|
|
<ServerItemComponent item={item} hasCheck={false} {...props} />
|
|
|
|
</ThemeContext.Provider>
|
|
|
|
);
|
2021-01-20 20:43:59 +00:00
|
|
|
|
|
|
|
stories.add('content', () => (
|
|
|
|
<>
|
2021-09-13 20:41:05 +00:00
|
|
|
<ServerItem hasCheck />
|
2021-01-20 20:43:59 +00:00
|
|
|
<ServerItem
|
|
|
|
item={{
|
|
|
|
...item,
|
|
|
|
name: 'Super Long Server Name in Rocket.Chat',
|
|
|
|
id: 'https://superlongservername.tologintoasuperlongservername/'
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<ServerItem
|
|
|
|
item={{
|
|
|
|
id: 'https://stable.rocket.chat/'
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
));
|
|
|
|
|
|
|
|
stories.add('touchable', () => (
|
|
|
|
<>
|
|
|
|
<ServerItem onLongPress={() => alert('Long Press')} onPress={() => alert('Press')} />
|
|
|
|
<ServerItem onPress={() => alert('Press')} />
|
|
|
|
<ServerItem onLongPress={() => alert('Long Press')} />
|
|
|
|
</>
|
|
|
|
));
|
|
|
|
|
|
|
|
stories.add('themes', () => (
|
|
|
|
<>
|
2022-03-22 13:53:09 +00:00
|
|
|
<ServerItem theme={themes.light} />
|
|
|
|
<ServerItem theme={themes.dark} />
|
|
|
|
<ServerItem theme={themes.black} />
|
2021-01-20 20:43:59 +00:00
|
|
|
</>
|
|
|
|
));
|