Skip to content

Commit

Permalink
Add empty text to webapp when no products exist in the catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesir87 committed Dec 23, 2024
1 parent fed72ad commit 3132c1f
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions dev/webapp/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,33 @@ function App() {
</p>

{catalog ? (
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>UPC</th>
<th>Inventory</th>
<th>Image</th>
</tr>
</thead>
<tbody>
{catalog.map((product) => (
<ProductRow
key={product.id}
product={product}
onChange={() => fetchCatalog()}
/>
))}
</tbody>
</table>
<>
{catalog.length === 0 ? (
<em>There are no products... yet!</em>
) : (
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>UPC</th>
<th>Inventory</th>
<th>Image</th>
</tr>
</thead>
<tbody>
{catalog.map((product) => (
<ProductRow
key={product.id}
product={product}
onChange={() => fetchCatalog()}
/>
))}
</tbody>
</table>
)}
</>
) : (
<p>Loading catalog...</p>
)}
Expand Down

0 comments on commit 3132c1f

Please sign in to comment.