mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-14 05:14:28 -08:00
redux example rename
This commit is contained in:
15
docs/examples/todos-redux/src/components/App.js
Normal file
15
docs/examples/todos-redux/src/components/App.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import Footer from './Footer.js'
|
||||
import AddTodo from '../containers/AddTodo.js'
|
||||
import VisibleTodoList from '../containers/VisibleTodoList.js'
|
||||
|
||||
const h = React.createElement
|
||||
|
||||
const App = () => (
|
||||
h('div', null,
|
||||
h(AddTodo),
|
||||
h(VisibleTodoList),
|
||||
h(Footer),
|
||||
)
|
||||
)
|
||||
|
||||
export default App
|
||||
15
docs/examples/todos-redux/src/components/Footer.js
Normal file
15
docs/examples/todos-redux/src/components/Footer.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import FilterLink from '../containers/FilterLink.js'
|
||||
import { VisibilityFilters } from '../actions/index.js'
|
||||
|
||||
const h = React.createElement
|
||||
|
||||
const Footer = () => (
|
||||
h('div', null,
|
||||
h('span', null, 'Show: '),
|
||||
h(FilterLink, {filter: VisibilityFilters.SHOW_ALL}, 'All'),
|
||||
h(FilterLink, {filter: VisibilityFilters.SHOW_ACTIVE}, 'Active'),
|
||||
h(FilterLink, {filter: VisibilityFilters.SHOW_COMPLETED}, 'Completed'),
|
||||
)
|
||||
)
|
||||
|
||||
export default Footer
|
||||
13
docs/examples/todos-redux/src/components/Link.js
Normal file
13
docs/examples/todos-redux/src/components/Link.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const h = React.createElement
|
||||
|
||||
const Link = ({ active, children, onClick }) => (
|
||||
h('button', {
|
||||
onClick,
|
||||
disabled: active,
|
||||
style:{
|
||||
marginLeft: '4px',
|
||||
}
|
||||
}, children)
|
||||
)
|
||||
|
||||
export default Link
|
||||
12
docs/examples/todos-redux/src/components/Todo.js
Normal file
12
docs/examples/todos-redux/src/components/Todo.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const h = React.createElement
|
||||
|
||||
const Todo = ({ onClick, completed, text }) => (
|
||||
h('li', {
|
||||
onClick,
|
||||
style: {
|
||||
textDecoration: completed ? 'line-through' : 'none'
|
||||
},
|
||||
}, text)
|
||||
)
|
||||
|
||||
export default Todo
|
||||
17
docs/examples/todos-redux/src/components/TodoList.js
Normal file
17
docs/examples/todos-redux/src/components/TodoList.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import Todo from './Todo.js'
|
||||
|
||||
const h = React.createElement
|
||||
|
||||
const TodoList = ({ todos, toggleTodo }) => (
|
||||
h('ul', null,
|
||||
todos.map(todo =>
|
||||
h(Todo, {
|
||||
key: todo.id,
|
||||
...todo,
|
||||
onClick: () => toggleTodo(todo.id),
|
||||
})
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
export default TodoList
|
||||
Reference in New Issue
Block a user