adding a new step to bring in Fabric controls

This commit is contained in:
Ken
2019-02-13 22:02:52 -08:00
parent 24733636ec
commit d0d6a788e2
14 changed files with 343 additions and 17 deletions

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { Stack } from '@uifabric/experiments';
import { TodoListItem } from './TodoListItem';
import { Store, FilterTypes } from '../store';
interface TodoListProps {
complete: (id: string) => void;
remove: (id: string) => void;
todos: Store['todos'];
filter: FilterTypes;
edit: (id: string, label: string) => void;
}
export class TodoList extends React.Component<TodoListProps> {
render() {
const { filter, todos, complete, remove, edit } = this.props;
const filteredTodos = Object.keys(todos).filter(id => {
return filter === 'all' || (filter === 'completed' && todos[id].completed) || (filter === 'active' && !todos[id].completed);
});
return (
<Stack verticalGap={10}>
{filteredTodos.map(id => (
<TodoListItem key={id} id={id} todos={todos} complete={complete} remove={remove} edit={edit} />
))}
</Stack>
);
}
}