2017-08-17 19:31:27 +00:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */
|
2017-12-08 19:36:03 +00:00
|
|
|
import React from 'react';
|
2020-07-31 17:06:22 +00:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { createStore, combineReducers } from 'redux';
|
2017-08-17 19:31:27 +00:00
|
|
|
import { storiesOf } from '@storybook/react-native';
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
import RoomItem from './RoomItem';
|
2018-09-11 16:32:52 +00:00
|
|
|
import Message from './Message';
|
2020-02-11 14:01:35 +00:00
|
|
|
import UiKitMessage from './UiKitMessage';
|
|
|
|
import UiKitModal from './UiKitModal';
|
2020-03-04 13:57:07 +00:00
|
|
|
import Markdown from './Markdown';
|
2020-10-30 13:12:02 +00:00
|
|
|
import Avatar from './Avatar';
|
2019-04-08 12:35:28 +00:00
|
|
|
// import RoomViewHeader from './RoomViewHeader';
|
2017-08-17 19:31:27 +00:00
|
|
|
|
2020-05-18 16:25:13 +00:00
|
|
|
import MessageContext from '../../app/containers/message/Context';
|
|
|
|
|
|
|
|
// MessageProvider
|
|
|
|
const baseUrl = 'https://open.rocket.chat';
|
|
|
|
const user = {
|
|
|
|
id: '',
|
|
|
|
username: 'diego.mello',
|
|
|
|
token: ''
|
|
|
|
};
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
// Change here to see themed storybook
|
|
|
|
const theme = 'light';
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
const reducers = combineReducers({
|
|
|
|
settings: () => ({}),
|
|
|
|
login: () => ({
|
|
|
|
user: {
|
|
|
|
username: 'diego.mello'
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
meteor: () => ({ connected: true }),
|
|
|
|
activeUsers: () => ({ abc: { status: 'online', statusText: 'dog' } })
|
|
|
|
});
|
|
|
|
const store = createStore(reducers);
|
2017-12-08 19:36:03 +00:00
|
|
|
|
2020-05-18 16:25:13 +00:00
|
|
|
const messageDecorator = story => (
|
|
|
|
<MessageContext.Provider
|
|
|
|
value={{
|
|
|
|
user,
|
|
|
|
baseUrl,
|
|
|
|
onPress: () => {},
|
|
|
|
onLongPress: () => {},
|
|
|
|
reactionInit: () => {},
|
|
|
|
onErrorPress: () => {},
|
|
|
|
replyBroadcast: () => {},
|
|
|
|
onReactionPress: () => {},
|
|
|
|
onDiscussionPress: () => {},
|
|
|
|
onReactionLongPress: () => {}
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{story()}
|
|
|
|
</MessageContext.Provider>
|
|
|
|
);
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
storiesOf('RoomItem', module)
|
|
|
|
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
|
|
|
|
.add('list roomitem', () => <RoomItem theme={theme} />);
|
2018-09-11 16:32:52 +00:00
|
|
|
storiesOf('Message', module)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list message', () => <Message theme={theme} />);
|
|
|
|
|
|
|
|
storiesOf('UiKitMessage', module)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list uikitmessage', () => <UiKitMessage theme={theme} />);
|
|
|
|
storiesOf('UiKitModal', module)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list UiKitModal', () => <UiKitModal theme={theme} />);
|
2020-03-04 13:57:07 +00:00
|
|
|
storiesOf('Markdown', module)
|
|
|
|
.add('list Markdown', () => <Markdown theme={theme} />);
|
2020-10-30 13:12:02 +00:00
|
|
|
storiesOf('Avatar', module)
|
|
|
|
.add('list Avatar', () => <Avatar theme={theme} />);
|
2020-02-11 14:01:35 +00:00
|
|
|
|
2019-04-08 12:35:28 +00:00
|
|
|
// FIXME: I couldn't make these pass on jest :(
|
|
|
|
// storiesOf('RoomViewHeader', module)
|
2019-12-04 16:39:53 +00:00
|
|
|
// .add('list', () => <RoomViewHeader theme='black' />);
|