added finished btn

This commit is contained in:
Jonas Hinterdorfer 2025-06-16 07:52:47 +02:00
parent d8da0c90a2
commit 31886bf989
2 changed files with 19 additions and 1 deletions

View File

@ -11,7 +11,7 @@ interface MoneyItem {
const ChangeCalculatorPage: React.FC = () => {
const navigate = useNavigate();
const { getTotalPrice } = useCart();
const { getTotalPrice, clearCart } = useCart();
const cartTotal = getTotalPrice();
const initialDenominations: MoneyItem[] = [
@ -61,6 +61,11 @@ const ChangeCalculatorPage: React.FC = () => {
setMoneyItems(initialDenominations.map(item => ({ ...item, count: 0 })));
};
const handleDoneClick = () => {
clearCart();
navigate('/');
};
return (
<div className="change-calculator-page">
<header className="details-header">
@ -68,6 +73,9 @@ const ChangeCalculatorPage: React.FC = () => {
&larr; Zurück
</button>
<h1>Restgeld</h1>
<button className="done-button" onClick={handleDoneClick}>
Fertig
</button>
</header>
<div className="calculator-container">

View File

@ -25,6 +25,16 @@
left: 15px;
}
.done-button {
background: none;
border: none;
color: white;
font-size: 1.2rem;
cursor: pointer;
padding: 0;
position: absolute;
right: 15px;
}
.details-header h1 {
flex: 1;
text-align: center;