Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Changed structure of todos example to be more similar to redux's example
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeyper committed Aug 22, 2017
1 parent 0c94872 commit 2be6e74
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 21 deletions.
1 change: 1 addition & 0 deletions docs/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
Redux Subspace is distributed with a few examples in its [source code](/examples). Most of these examples are also on [CodeSandbox](https://codesandbox.io/), this is an online editor that lets you play with the examples online.

* [Counter](/examples/counter)
* [Todos](/examples/todos)
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from 'react'
import { connect } from 'react-redux'
import { SubspaceProvider } from 'react-redux-subspace'
import { Footer } from '../Footer'
import { AddTodo, VisibleTodoList } from '../Todos'
import { Footer } from '../../Footer'
import { TodoApp } from '../../Todos'

const App = ({ filter }) => (
<div>
<SubspaceProvider namespace='todos'>
<div>
<AddTodo />
<VisibleTodoList filter={filter} />
</div>
<TodoApp filter={filter} />
</SubspaceProvider>
<SubspaceProvider mapState={(state) => state.visibilityFilter} namespace='footer'>
<Footer />
Expand Down
4 changes: 2 additions & 2 deletions examples/todos/src/App/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as App } from './App'
export { default as reducer } from './reducer'
export { default as App } from './containers/App'
export { default as reducer } from './reducers'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { combineReducers } from 'redux'
import { namespaced } from 'redux-subspace'
import { reducer as todos } from '../Todos'
import { reducer as visibilityFilter } from '../Footer'
import { reducer as todos } from '../../Todos'
import { reducer as visibilityFilter } from '../../Footer'

const app = combineReducers({
todos: namespaced('todos')(todos),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import FilterLink from './FilterLink'
import FilterLink from '../containers/FilterLink'

const Footer = () => (
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import { setVisibilityFilter } from './actions'
import Link from './Link'
import { setVisibilityFilter } from '../actions'
import Link from '../components/Link'

const mapStateToProps = (state, ownProps) => ({
active: ownProps.filter === state
Expand Down
4 changes: 2 additions & 2 deletions examples/todos/src/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as Footer } from './Footer'
export { default as reducer } from './reducer'
export { default as Footer } from './components/Footer'
export { default as reducer } from './reducers'
12 changes: 12 additions & 0 deletions examples/todos/src/Todos/components/TodoApp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react'
import AddTodo from '../containers/AddTodo'
import VisibleTodoList from '../containers/VisibleTodoList'

const TodoApp = ({ filter }) => (
<div>
<AddTodo />
<VisibleTodoList filter={filter} />
</div>
)

export default TodoApp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { connect } from 'react-redux'
import { addTodo } from './actions'
import { addTodo } from '../actions'

let AddTodo = ({ dispatch }) => {
let input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { connect } from 'react-redux'
import { toggleTodo } from './actions'
import TodoList from './TodoList'
import { toggleTodo } from '../actions'
import TodoList from '../components/TodoList'

const getVisibleTodos = (todos, filter) => {
switch (filter) {
Expand Down
5 changes: 2 additions & 3 deletions examples/todos/src/Todos/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as AddTodo } from './AddTodo'
export { default as VisibleTodoList } from './VisibleTodoList'
export { default as reducer } from './reducer'
export { default as TodoApp } from './components/TodoApp'
export { default as reducer } from './reducers'

0 comments on commit 2be6e74

Please sign in to comment.