-
Notifications
You must be signed in to change notification settings - Fork 74
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
base: main
Are you sure you want to change the base?
Conversation
|
||
## Requirements | ||
|
||
To install and launch the app, you will need NodeJS v16+ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
src/Components/ItemsList.js
Outdated
//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 |
There was a problem hiding this comment.
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 :)
src/Components/ItemsList.js
Outdated
//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 |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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 :)!
src/Components/ItemsList.js
Outdated
if (item.key === key) { | ||
item.isChecked = !item.isChecked; | ||
} | ||
return { ...item }; |
There was a problem hiding this comment.
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!
src/Components/ItemsList.js
Outdated
this.setState({ itemsList: itemsList }); | ||
localStorage.setItem("itemsList", JSON.stringify(itemsList)); | ||
}; | ||
//5) logic to clear all items |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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+ |
There was a problem hiding this comment.
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
/*max-width: 400px; | ||
min-width: 340px; | ||
margin: 40px auto; */ |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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
src/Components/ItemsList.js
Outdated
if (item.key === key) { | ||
item.name = name; | ||
} | ||
return { ...item }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return { ...item }; | |
return item; |
This is the same thing
No description provided.