Skip to content

Commit

Permalink
Merge pull request #24 from the-collab-lab/jo-mm-welcome-prompt
Browse files Browse the repository at this point in the history
Added prompt for user
  • Loading branch information
Tomiogunsan authored Sep 3, 2024
2 parents d119459 + 11b466f commit a20a91a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/views/List.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useEffect, useState } from 'react';
import { ListItem, SearchBar } from '../components';
import { useNavigate } from 'react-router-dom';

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

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

0 comments on commit a20a91a

Please sign in to comment.