lenhuthao0777 / df-frontend-2023

https://df-frontend-2023-xi.vercel.app
0 stars 0 forks source link

Submission for assignment 2 #4

Open lenhuthao0777 opened 11 months ago

lenhuthao0777 commented 11 months ago

Link demo: https://df-frontend-2023-reactjs.vercel.app/

chinhld12 commented 11 months ago

Hello @lenhuthao0777, nice work!

Requirements

Final result: ✅ passed

Feedback

  1. You should implement requirements for the input fields to prevent any cases of missing input for adding new book form. Encountered this error if I left the topic not selected. And the create new book if leave all fields blank will create with previous values.
image
  1. Naming variables should be more meaningful reflecting the code itself.

-> isOpen -> isOpenModal -> type -> modalType

https://github.com/lenhuthao0777/df-frontend-2023/blob/3b55ef199a3791d519fb766a3f0e8b640c19a58d/assignment-2/src/pages/add-modal.jsx#L17-L18

  1. To enhance maintainability and readability, it's advisable to separate the states for managing books and modal handlers in the Context API. This separation can make your code more organized, prevent potential memory leaks as the state grows, and make it easier to manage in the long term.

  2. Consider using conditional rendering to add the dark class to the className property of the root element (e.g., App.js) instead of toggling it directly on the html element. This approach is more in line with React's declarative nature and can make your code easier to manage and maintain.

image

https://github.com/lenhuthao0777/df-frontend-2023/blob/3b55ef199a3791d519fb766a3f0e8b640c19a58d/assignment-2/src/providers/theme-provider.jsx#L12-L14

  1. You can improve your code by utilizing Tailwind Variants to define variants for elements that are natively supported by Tailwind, instead of class-variance-authority. This will make your code more in line with Tailwind's conventions and simplify your styles.