diff --git a/src/App.tsx b/src/App.tsx index 570b366a4..1bfad25d8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -227,9 +227,9 @@ export const App: React.FC = () => { inputRef={inputRef} inputText={inputText} setInputText={setInputText} - createFunc={handleAddingTodo} + handleCreateTodo={handleAddingTodo} todos={todos} - completeFunc={handleSwitchTodosStatus} + handleCompleteTodo={handleSwitchTodosStatus} loadingTodos={loadingTodos} /> diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index a26f87cf9..793764219 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -8,8 +8,8 @@ type Props = { inputRef: React.RefObject; inputText: string; setInputText: (value: string) => void; - createFunc: () => void; - completeFunc: () => void; + handleCreateTodo: () => void; + handleCompleteTodo: () => void; todos: Todo[]; loadingTodos: number[]; }; @@ -18,11 +18,13 @@ export const Header: React.FC = ({ inputRef, inputText, setInputText, - createFunc, - completeFunc, + handleCreateTodo, + handleCompleteTodo, todos, loadingTodos, }) => { + const includesActiveTodos = todos.filter(todo => !todo.completed).length > 0; + return (
{/* this button should have `active` class only if all todos are completed */} @@ -30,12 +32,10 @@ export const Header: React.FC = ({