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

Develop #1769

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Develop #1769

wants to merge 6 commits into from

Conversation

przwojwwp
Copy link

Copy link

@BogdanMaliuta BogdanMaliuta left a comment

Choose a reason for hiding this comment

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

Nice, but your code needs some changes

src/App.tsx Outdated
</td>
return (
<main className="section container">
{selectedGood === '' ? (

Choose a reason for hiding this comment

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

Suggested change
{selectedGood === '' ? (
{!selectedGood ? (

src/App.tsx Outdated
data-cy="ClearButton"
type="button"
className="delete ml-3"
onClick={() => this.setState({ selectedGood: '' })}

Choose a reason for hiding this comment

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

you have handler handleRemoveGood

key={index}
data-cy="Good"
className={
selectedGood === good ? 'has-background-success-light' : ''

Choose a reason for hiding this comment

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

Suggested change
selectedGood === good ? 'has-background-success-light' : ''
'has-background-success-light' : selectedGood === good

Copy link
Author

Choose a reason for hiding this comment

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

              className={
                selectedGood === good && 'has-background-success-light'
              }
              
              Type 'false | "has-background-success-light"' is not assignable to type 'string | undefined'.

Copy link

Choose a reason for hiding this comment

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

Yea i guess that this syntax requires classnames package

src/App.tsx Outdated
Comment on lines 64 to 84
<td>
{selectedGood === good ? (
<button
data-cy="RemoveButton"
type="button"
className="button is-info"
onClick={this.handleRemoveGood}
>
-
</button>
) : (
<button
data-cy="AddButton"
type="button"
className="button"
onClick={() => this.handleSelectGood(good)}
>
+
</button>
)}
</td>

Choose a reason for hiding this comment

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

just change your content(+/-) using condition, and improve your handleRemoveGood by checking inside is selected good === good, and clear if true

Copy link

@Zibi95 Zibi95 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! Left some comments for future reference.

key={index}
data-cy="Good"
className={
selectedGood === good ? 'has-background-success-light' : ''
Copy link

Choose a reason for hiding this comment

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

Yea i guess that this syntax requires classnames package

{goods.map((good, index) => {
return (
<tr
key={index}
Copy link

Choose a reason for hiding this comment

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

Using the index as a key is not a good practice. In this case, it doesn’t matter, but remember to avoid it. If you have a unique value, use that instead.

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.

3 participants