Skip to content

Commit

Permalink
Added prompt for user
Browse files Browse the repository at this point in the history
  • Loading branch information
joriordan332 committed Sep 3, 2024
1 parent 333739a commit e76b335
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Binary file added src/pictures/addFirstItem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/views/List.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { useEffect, useState } from 'react';
import { ListItem, SearchBar } from '../components';
import { useNavigate } from 'react-router-dom';
import addFirstItem from '../pictures/addFirstItem.png';

export function List({ data }) {
const [search, setSearch] = useState('');
const [displayData, setDisplayData] = useState([]);
const navigate = useNavigate();

useEffect(() => {
setDisplayData([...data]);
Expand All @@ -22,6 +25,22 @@ export function List({ data }) {
<ListItem key={item.id} name={item.name} />
))}
</ul>
{data.length === 0 && (
<div>
<img
className="addItemPNG"
src={addFirstItem}
alt="add item example"
/>
<p>
You currently have no shopping items click below to add items like
shown above
</p>
<button id="addFirstItem" onClick={() => navigate('/manage-list')}>
Start adding items!
</button>
</div>
)}
</>
);
}

0 comments on commit e76b335

Please sign in to comment.