Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #22 from davezuko/refactor/cleanup
Browse files Browse the repository at this point in the history
refactor(example): removes unnecessary example components that pollut…
  • Loading branch information
David Zukowski committed Aug 16, 2015
2 parents fbb824e + 90e0e23 commit 82a4ee6
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 275 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Table of Contents
1. [Testing](#testing)
1. [Utilities](#utilities)
1. [Deployment](#deployment)
1. [Examples](#examples)
1. [Troubleshooting](#troubleshooting)

Requirements
Expand Down Expand Up @@ -229,6 +230,13 @@ Deployment
* Add io.js as a buildpack:
- In `~/ENV` append: `export BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs`

Examples
--------

Have an application you'd like to showcase that uses this starter kit? Feel free to list it here!

1. [Example TODO Application](https://github.com/davezuko/react-redux-starter-kit/tree/example/todo-application) - This is the example that originally came packaged with the starter-kit; it's since been separated so that you can spend less time clearing out sample code and more time developing something new!

Troubleshooting
---------------

Expand Down
1 change: 1 addition & 0 deletions docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Documentation

Improvements
------------
* [ ] Move example application to separate repo.
* [ ] Move bootstrap dependency to core styles file.

Redux
Expand Down
10 changes: 4 additions & 6 deletions server/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ describe('Koa Server', function () {
it('Should respond with a 200.', function (done) {
request
.get('/')
.expect(200, done)
.expect(200, done);
});
});

describe('GET /about', function () {
it('Should respond with a 200.', function (done) {
it('Should respond with sample welcome text.', function (done) {
request
.get('/about')
.expect(200, done)
.get('/')
.expect(/Welcome to the React Redux Starter Kit/, done);
});
});
});
26 changes: 0 additions & 26 deletions src/actions/todo/index.js

This file was deleted.

34 changes: 0 additions & 34 deletions src/components/todo-item/index.jsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/todo-item/todo-item.scss

This file was deleted.

44 changes: 0 additions & 44 deletions src/components/todo-list/index.jsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/constants/todo.js

This file was deleted.

8 changes: 3 additions & 5 deletions src/layouts/core/core-layout.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// This imports /styles/core.scss which includes normalize.css
// All application-wide styles should reside in the /styles, whereas component-
// specific can live in their component-level .scss file.
@import 'core';

.view-container {
max-width: 1000px;
margin: 0 auto;
}
9 changes: 0 additions & 9 deletions src/layouts/core/core-layout.spec.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as todos } from './todos';
export { default as sample } from './sample';
13 changes: 13 additions & 0 deletions src/reducers/sample/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createReducer } from 'utils';

// normally this would be imported from /constants, but in trying to keep
// this starter kit as easy to customize as possibility we'll just define
// the constant here.
const SAMPLE_ACTION = 'SAMPLE_ACTION';
const initialState = {
message : 'Welcome to the React Redux Starter Kit!'
};

export default createReducer(initialState, {
[SAMPLE_ACTION] : (state, payload) => state // aka noop
});
33 changes: 0 additions & 33 deletions src/reducers/todos/index.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/reducers/todos/index.spec.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/routes/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { Route } from 'react-router';
import React from 'react';
import CoreLayout from 'layouts/core';
import HomeView from 'views/home';
import AboutView from 'views/about';

export default (
<Route component={CoreLayout}>
<Route name='home' path='/' component={HomeView} />
<Route name='about' path='/about' component={AboutView} />
</Route>
);
16 changes: 0 additions & 16 deletions src/views/about/index.jsx

This file was deleted.

63 changes: 5 additions & 58 deletions src/views/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,18 @@
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import * as TodoActionCreators from 'actions/todo';
import TodoList from 'components/todo-list';

// TODO: make the create-todo form a component so that a bound action
// can be provided rather than manually using this.props.dispatch(action)
@connect(state => ({ todos : state.todos }))
@connect(state => ({
sampleStore : state.sample
}))
export default class HomeView extends React.Component {
constructor () {
super();
this.state = {
todo : ''
};
}

componentWillMount () {
this._todoActions = bindActionCreators(
TodoActionCreators, this.props.dispatch
);
}

_bindTo (prop) {
return (e) => this.setState({
[prop] : e.target.value
});
}

_createTodo (e) {
e.preventDefault();
this.props.dispatch(TodoActionCreators.createTodo(this.state.todo));
this.setState({
todo : ''
});
}

renderNewTodoForm () {
return (
<form onSubmit={::this._createTodo}>
<div className='row'>
<div className='col-sm-9'>
<input className='form-control'
placeholder='Do something else!'
value={this.state.todo}
onChange={this._bindTo('todo')} />
</div>
<div className='col-sm-3'>
<button type='submit' className='btn btn-block btn-default'>
Create Todo
</button>
</div>
</div>
</form>
);
}

render () {
const todos = this.props.todos.toJS();

return (
<div className='view view--home'>
<div className='row'>
<div className='col-md-8 col-md-offset-2'>
<TodoList todos={todos} {...this._todoActions} />
{this.renderNewTodoForm()}
</div>
</div>
<div className='view view--home container'>
<h1 className='text-center'>{this.props.sampleStore.message}</h1>
</div>
);
}
Expand Down
9 changes: 9 additions & 0 deletions src/views/home/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import HomeView from './index';

describe('(View) Home', function () {

it('Should have a test that works with Chai expectations.', function () {
expect(true).to.be.true;
});
});

0 comments on commit 82a4ee6

Please sign in to comment.