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

Marina's project 1: My shopping list app #43

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

Conversation

Mannushka
Copy link

No description provided.


## Requirements

To install and launch the app, you will need NodeJS v16+

Choose a reason for hiding this comment

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

How do I actually install the app?

Choose a reason for hiding this comment

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

You could also tell the reader how to install node

src/App.js Outdated
<Container className="App mt-5 col-11 col-md-6 col-lg-5 align-items-center">
<Stack gap={2}>
<div className="header">My shopping list</div>
<div>

Choose a reason for hiding this comment

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

Since ItemsList also has a <div> as wrapper, do we need this one?

<div>
<Container className="col-12 col-lg-11 text-center">
<InputGroup id="main-input-field" className="mb-3 mt-4">
<Form.Control

Choose a reason for hiding this comment

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

Not 100% sure here, but do we need to use a Form element here, when we actually are not using a form? Wouldn't a normal input suffice, to which we can apply bootstrap classes?

Comment on lines 13 to 18
//We need to be able to add items to the list
//Items are added in the UserInput component: when user inputs something into the input field and then clicks "add item" , the item should get added into the itemsArray
//Each item can be deleted
//Each item can be changed
//Each item can be edited
//Each item has checkbox, once the user got the item, they may tick the checkbox and the item will get crossed out

Choose a reason for hiding this comment

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

this is already documented in the README and shouldn't live in our code :)

//Each item can be edited
//Each item has checkbox, once the user got the item, they may tick the checkbox and the item will get crossed out

//1) adding items logic

Choose a reason for hiding this comment

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

Redundant comment, as the function name already suggests what is being done here


//4) crossing items out logic
//this function is passed as props to Items
checkItem = (key) => {

Choose a reason for hiding this comment

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

If comment says crosing out, but function says checking, what is it? crossing or checking? Name accordingly I would advise :)!

Comment on lines 59 to 62
if (item.key === key) {
item.isChecked = !item.isChecked;
}
return { ...item };

Choose a reason for hiding this comment

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

Same problem as highlighted above!

this.setState({ itemsList: itemsList });
localStorage.setItem("itemsList", JSON.stringify(itemsList));
};
//5) logic to clear all items

Choose a reason for hiding this comment

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

can remove

import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
import Form from "react-bootstrap/Form";
export default class Items extends React.Component {

Choose a reason for hiding this comment

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

This component is describing how a single Item looks like. I would recommend naming it in singular because of that. Item instead of Items

import Form from "react-bootstrap/Form";
export default class Items extends React.Component {
render() {
const items = this.props.itemsList.map((item, key) => {

Choose a reason for hiding this comment

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

If I compare ItemsList with Items, I don't see how the list is an actual list. You are rendering the list in this component. To correct this, I would run this map in the ItemsList component and pass down the updater etc. functions to the Item component, within the map, which will then determine how the updating/deletion etc. works

Choose a reason for hiding this comment

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

in ItemsList it should look like this:

render() {
    return {this.itemsList.map((item, key) => {
      return <Item item={item} key={key} />
}}
}


## Requirements

To install and launch the app, you will need NodeJS v16+

Choose a reason for hiding this comment

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

You could also tell the reader how to install node

src/App.css Outdated
Comment on lines 8 to 10
/*max-width: 400px;
min-width: 340px;
margin: 40px auto; */

Choose a reason for hiding this comment

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

can remove comments

import Form from "react-bootstrap/Form";
export default class Items extends React.Component {
render() {
const items = this.props.itemsList.map((item, key) => {

Choose a reason for hiding this comment

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

in ItemsList it should look like this:

render() {
    return {this.itemsList.map((item, key) => {
      return <Item item={item} key={key} />
}}
}

);
});

return <div>{items}</div>;

Choose a reason for hiding this comment

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

Here you are wrapping the items in another div again, not sure if that is desired or not

if (item.key === key) {
item.name = name;
}
return { ...item };
Copy link

@Flashrob Flashrob Dec 13, 2023

Choose a reason for hiding this comment

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

Suggested change
return { ...item };
return item;

This is the same thing

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