Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import logo from './logo.svg';
import './App.css';
import { Provider } from 'react-redux';
import store from './lib/redux';

import InboxScreen from './components/InboxScreen';

import './index.css';

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
<Provider store={store}>
<InboxScreen />
</Provider>
);
}

export default App;
41 changes: 41 additions & 0 deletions src/components/InboxScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import PropTypes from 'prop-types';

import { connect } from 'react-redux';

import TaskList from './TaskList';

export function PureInboxScreen({ error }) {
if (error) {
return (
<div className="page lists-show">
<div className="wrapper-message">
<span className="icon-face-sad" />
<div className="title-message">Oh no!</div>
<div className="subtitle-message">Something went wrong</div>
</div>
</div>
);
}
return (
<div className="page lists-show">
<nav>
<h1 className="title-page">
<span className="title-wrapper">Taskbox</span>
</h1>
</nav>
<TaskList />
</div>
);
}

PureInboxScreen.propTypes = {
/** The error message */
error: PropTypes.string,
};

PureInboxScreen.defaultProps = {
error: null,
};

export default connect(({ error }) => ({ error }))(PureInboxScreen);
33 changes: 33 additions & 0 deletions src/components/InboxScreen.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import { Provider } from 'react-redux';

import { PureInboxScreen } from './InboxScreen';
import { action } from '@storybook/addon-actions';
import * as TaskListStories from './TaskList.stories';

// A super-simple mock of a redux store
const store = {
getState: () => {
return {
tasks: TaskListStories.Default.args.tasks,
};
},
subscribe: () => 0,
dispatch: action('dispatch'),
};


export default {
component: PureInboxScreen,
decorators: [story => <Provider store={store}>{story()}</Provider>],
title: 'InboxScreen',
};

const Template = args => <PureInboxScreen {...args} />;

export const Default = Template.bind({});

export const Error = Template.bind({});
Error.args = {
error: 'Something',
};
7 changes: 7 additions & 0 deletions src/components/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export default function Task({ task: { id, title, state }, onArchiveTask, onPinT
<span className="checkbox-custom" onClick={() => onArchiveTask(id)} />
</label>
<div className="title">
<input
type="text"
value={title}
readOnly={true}
placeholder="Input title"
style={{ background: 'red' }}
/>
<input type="text" value={title} readOnly={true} placeholder="Input title" />
</div>

Expand Down
1 change: 1 addition & 0 deletions storybook-static/0.07e21503.iframe.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions storybook-static/0.b73eaee9a88f178d62ed.manager.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions storybook-static/1.f296d183a17268696d73.manager.bundle.js

Large diffs are not rendered by default.

Loading