mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
29 lines
715 B
TypeScript
29 lines
715 B
TypeScript
import React from 'react';
|
|
import { Store } from '../store';
|
|
import { DefaultButton, Stack, Text } from 'office-ui-fabric-react';
|
|
|
|
interface TodoFooterProps {
|
|
clear: () => void;
|
|
todos: Store['todos'];
|
|
}
|
|
|
|
export const TodoFooter = (props: TodoFooterProps) => {
|
|
const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length;
|
|
|
|
return (
|
|
<Stack horizontal horizontalAlign="space-between">
|
|
<Text>
|
|
{itemCount} item{itemCount === 1 ? '' : 's'} left
|
|
</Text>
|
|
<DefaultButton
|
|
onClick={() => props.clear()}
|
|
styles={{
|
|
root: { fontStyle: 'oblique' }
|
|
}}
|
|
>
|
|
Clear Completed
|
|
</DefaultButton>
|
|
</Stack>
|
|
);
|
|
};
|