Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amos zohar #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Amos zohar #9

wants to merge 3 commits into from

Conversation

azamos
Copy link

@azamos azamos commented Apr 13, 2024

No description provided.

@Tamir198 Tamir198 self-requested a review April 13, 2024 14:46
Copy link
Member

@Tamir198 Tamir198 left a comment

Choose a reason for hiding this comment

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

Good job on your work, left you some comments.

Please remove your comments. the code should be self explained.

Also, comment like this :

  /* Additional styles to ensure the rest of the content flows */
  margin: 0;
  padding: 0;

Are not needed for some one who knows css.

flex-direction: row;
justify-content: flex-start;
/* align-items:center; */
}
Copy link
Member

Choose a reason for hiding this comment

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

Remove this if you are not using

justify-content: space-around;
padding: 1vmax;
/* align-items:center; */
}
Copy link
Member

Choose a reason for hiding this comment

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

Same comment in here - remove if not used

const [tasksList, setTasksList] = useState([]);
const [filteredTasksList,setFilteredTasksList] = useState([]);
const [selected, setSelected] = useState(ALL);

Copy link
Member

Choose a reason for hiding this comment

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

Good job using constants, I think a better name for your folder would be constants because those are constants values

const [selected, setSelected] = useState(ALL);

useEffect(() => setTasksList(tasks), []);
const addTask = (description) =>
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why you used the use effect hook when your data is hardcoded? you could simply const [tasksList, setTasksList] = useState(tasks);

Was there any reason for it ?

return !task.active;
default:
return true;
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you need the default here? It seems to me that the task will either be active or not. Do you have a scenario where no case matches?

import {ALL,ACTIVE,COMPLETED} from '../mock';
const CLEAR_COMPLETED = "Clear Completed";
const itemsString = amount => `${amount} items left`;
const Navbar = ({filterHandler,clearHandler,counter}) =>
Copy link
Member

Choose a reason for hiding this comment

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

Could you think of a better name for this variable?
We should understand from the name of a variable its meaning( for example itemsLeft )


const tasks = [
{
id: 1,
Copy link
Member

Choose a reason for hiding this comment

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

Hey, about that file name suggestion I made earlier, I think it would be better to split the mock data into its file, separate from the constants. I initially thought this file was just for constants.

For example

constants.js :

const ACTIVE = "Active";
const COMPLETED = "Completed";
const ALL = "All";

mocks.js :

const tasks = [
  {
  .
  .
  ]

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