verdnatura-chat/storybook/stories/index.js

77 lines
2.1 KiB
JavaScript
Raw Normal View History

2017-08-17 19:31:27 +00:00
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */
import React from 'react';
import { Provider } from 'react-redux';
import { createStore, combineReducers } from 'redux';
2017-08-17 19:31:27 +00:00
import { storiesOf } from '@storybook/react-native';
import RoomItem from './RoomItem';
import Message from './Message';
2020-02-11 14:01:35 +00:00
import UiKitMessage from './UiKitMessage';
import UiKitModal from './UiKitModal';
import Markdown from './Markdown';
2019-04-08 12:35:28 +00:00
// import RoomViewHeader from './RoomViewHeader';
2017-08-17 19:31:27 +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';
const reducers = combineReducers({
settings: () => ({}),
login: () => ({
user: {
username: 'diego.mello'
}
}),
meteor: () => ({ connected: true }),
activeUsers: () => ({ abc: { status: 'online', statusText: 'dog' } })
});
const store = createStore(reducers);
const messageDecorator = story => (
<MessageContext.Provider
value={{
user,
baseUrl,
onPress: () => {},
onLongPress: () => {},
reactionInit: () => {},
onErrorPress: () => {},
replyBroadcast: () => {},
onReactionPress: () => {},
onDiscussionPress: () => {},
onReactionLongPress: () => {}
}}
>
{story()}
</MessageContext.Provider>
);
storiesOf('RoomItem', module)
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
.add('list roomitem', () => <RoomItem theme={theme} />);
storiesOf('Message', module)
.addDecorator(messageDecorator)
2020-02-11 14:01:35 +00:00
.add('list message', () => <Message theme={theme} />);
storiesOf('UiKitMessage', module)
.addDecorator(messageDecorator)
2020-02-11 14:01:35 +00:00
.add('list uikitmessage', () => <UiKitMessage theme={theme} />);
storiesOf('UiKitModal', module)
.addDecorator(messageDecorator)
2020-02-11 14:01:35 +00:00
.add('list UiKitModal', () => <UiKitModal theme={theme} />);
storiesOf('Markdown', module)
.add('list Markdown', () => <Markdown 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' />);