2nd Homework
The goal of this homework is to add new features in the to-do list.
There are 4 steps:
- Design TodoList and TodoListItems components
- Add a 'delete item' feature
- Add tabs for all / completed / not completed
- Send a link to a working to-do list
Deadline: Monday 3/10/2022 - 23:59:59
Step 0: Connect to the Server
- Connect to the remote server using your editor of choice
- Make sure you base your work on the
practical-02-end
branch of thevse-4it580
git repository:
To get the latest state of Quacker in your folder, open your terminal and run the following commands on the server:
This will fetch the newly created branch practical-02-end
from the GitHub origin and reset your code to the final state of the 2nd practical class.
If you have trouble connecting, see "Hello, Server!" guide or contact your teacher.
Step 1: Design TodoList and TodoListItems components
Create components using design on screenshot below (be as close as possible). Use Chakra UI, for more info see here.
Usefull Chakra UI components:
Step 2: Add a 'Delete Item' Feature
Implement a feature that will delete a specific to-do list item by clicking a button next to the item name.
- Add a button for deleting an item
- Create a
deleteItem
action inuseTodoList
hook- Use
array.filter()
to delete an item from an array in the state - Expose the function by adding it in the return value of
useTodoList
- Use
- When the user clicks the delete button, call the
deleteItem
function with the necessary arguments
Step 3: Add Tabs for All / Completed / Not completed Items
- Add a new property
filter
inuseTodoList
state to track the current tab - Create a
setFilter
function inuseTodoList
- Connect
filter
andsetFilter
with theTabs
using props - Return the correctly filtered
items
based on the activefilter
- Use
array.filter()
to filter the items accordingly
- Use
- Use Tabs components from Chakra UI (see example below)
Send a Link to a Working To-do List
Once you are finished:
- send a link to a working to-do list
http://dev.frontend.USERNAME
.vse.handson.pro/practical/02 - using MS Teams to: Tomas Horacek (@hort19)
Deadline: Monday 3/10/2022 - 23:59:59