Skip to content

Commit

Permalink
Disabled clearing on empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
mahammad-mostafa committed Aug 26, 2023
1 parent 801e947 commit 52ff633
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Footer = ({ total, handler }) => (
{total.toFixed(2)}
</span>
</div>
<button className={Styles.clear} type="button" onClick={() => handler(true)}>Clear Cart</button>
<button className={Styles.clear} type="button" onClick={() => handler(true)} disabled={total === 0}>Clear Cart</button>
</footer>
);

Expand Down
5 changes: 5 additions & 0 deletions src/styles/footer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
background-color: var(--bright-color);
}

.clear:disabled {
color: var(--dark-color);
background-color: var(--border-color);
}

@media only screen and (min-width: 768px) {
.container {
max-width: 1000px;
Expand Down

0 comments on commit 52ff633

Please sign in to comment.