Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
villanovachile committed Feb 28, 2023
1 parent a942651 commit a623491
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/AddItemForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {useRef} from 'react';



const AddItemForm = ({addItem, items}) => {
const AddItemForm = ({handleAddItem, items}) => {

const itemInput = useRef();

Expand All @@ -19,7 +19,7 @@ const AddItemForm = ({addItem, items}) => {
});

if (!dupe && input) {
addItem(itemInput.current.value.replace(/(^|\s)[a-z]/g, f => f.toUpperCase()));
handleAddItem(itemInput.current.value.replace(/(^|\s)[a-z]/g, f => f.toUpperCase()));
e.currentTarget.reset();
}

Expand Down
4 changes: 2 additions & 2 deletions src/components/Item.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';


const Item = ({item, id, removeItem}) => {
const Item = ({item, id, handleRemoveItem}) => {
return (
<span className='list-item'>
<button className='remove-item' onClick={() => removeItem(id)}></button>
<button className='remove-item' onClick={() => handleRemoveItem(id)}></button>
{item}
</span>

Expand Down
6 changes: 3 additions & 3 deletions src/components/ItemsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import React from 'react';
import Item from './Item';
import AddItemForm from './AddItemForm';

const ItemsList = ({items, addItem, gameState, removeItem}) => {
const ItemsList = ({items, handleAddItem, gameState, handleRemoveItem}) => {

if (gameState === 'start') {
return (
<div className="items-list">

<AddItemForm
addItem={addItem}
handleAddItem={handleAddItem}
items={items}
/>
{items.map(item =>
<Item
item={item.item}
removeItem={removeItem}
handleRemoveItem={handleRemoveItem}
score={item.score}
id={item.id}
key={item.id.toString()}
Expand Down

0 comments on commit a623491

Please sign in to comment.