added finished btn
This commit is contained in:
parent
d8da0c90a2
commit
31886bf989
@ -11,7 +11,7 @@ interface MoneyItem {
|
|||||||
|
|
||||||
const ChangeCalculatorPage: React.FC = () => {
|
const ChangeCalculatorPage: React.FC = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { getTotalPrice } = useCart();
|
const { getTotalPrice, clearCart } = useCart();
|
||||||
const cartTotal = getTotalPrice();
|
const cartTotal = getTotalPrice();
|
||||||
|
|
||||||
const initialDenominations: MoneyItem[] = [
|
const initialDenominations: MoneyItem[] = [
|
||||||
@ -61,6 +61,11 @@ const ChangeCalculatorPage: React.FC = () => {
|
|||||||
setMoneyItems(initialDenominations.map(item => ({ ...item, count: 0 })));
|
setMoneyItems(initialDenominations.map(item => ({ ...item, count: 0 })));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDoneClick = () => {
|
||||||
|
clearCart();
|
||||||
|
navigate('/');
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="change-calculator-page">
|
<div className="change-calculator-page">
|
||||||
<header className="details-header">
|
<header className="details-header">
|
||||||
@ -68,6 +73,9 @@ const ChangeCalculatorPage: React.FC = () => {
|
|||||||
← Zurück
|
← Zurück
|
||||||
</button>
|
</button>
|
||||||
<h1>Restgeld</h1>
|
<h1>Restgeld</h1>
|
||||||
|
<button className="done-button" onClick={handleDoneClick}>
|
||||||
|
Fertig
|
||||||
|
</button>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div className="calculator-container">
|
<div className="calculator-container">
|
||||||
|
|||||||
@ -25,6 +25,16 @@
|
|||||||
left: 15px;
|
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 {
|
.details-header h1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user