Skip to content

todos with context#1313

Open
petrushinsky-kirill wants to merge 2 commits into
mate-academy:masterfrom
petrushinsky-kirill:develop
Open

todos with context#1313
petrushinsky-kirill wants to merge 2 commits into
mate-academy:masterfrom
petrushinsky-kirill:develop

Conversation

@petrushinsky-kirill

Copy link
Copy Markdown

@brespect brespect left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done, but you need to fix UI inpuit focus:
Image

Comment thread src/context/global-context.tsx Outdated
Comment on lines +3 to +18
type Action =
| { type: 'add'; payload: Todo }
| { type: 'remove'; payload: { id: number } }
| { type: 'toggle'; payload: { id: number } }
| { type: 'edit'; payload: { id: number; title: string } }
| { type: 'setFilter'; payload: FilterType }
| { type: 'clearCompleted' }
| { type: 'toggle_all' };

export type Todo = {
id: number;
title: string;
completed: boolean;
};

export type FilterType = 'all' | 'active' | 'completed';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to separate enum/types files folder


const reducer = (state: State, action: Action): State => {
switch (action.type) {
case 'add':

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Enum string values here, check everywhere

@brespect brespect left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants