handle singular form names of pizzas and bottles

This commit is contained in:
leander committed 2026-10-31 01:16:09 +01:00
1 parent b3250363e5
commit 365ba26a6e
1 file changed
+12 -7
+12 -7
View File
@@ -28,6 +28,11 @@ const Calculator = () => {
const [thirstiness, setThirstiness] = useState(50); const [thirstiness, setThirstiness] = useState(50);
const [hungriness, setHungriness] = useState(3); const [hungriness, setHungriness] = useState(3);
const liters = calculateLiters(people, thirstiness);
const bottles = calculateBottles(people, thirstiness);
const pizzaSlices = calculatePizzaSlices(people, hungriness);
const pizzas = calculatePizzas(people, hungriness);
return ( return (
<main className={styles.container}> <main className={styles.container}>
<form className={styles.form} onSubmit={(e) => e.preventDefault()}> <form className={styles.form} onSubmit={(e) => e.preventDefault()}>
@@ -78,31 +83,31 @@ const Calculator = () => {
<div className={styles.results}> <div className={styles.results}>
<p> <p>
<span className={styles.big}> <span className={styles.big}>
{formatNumber(calculateLiters(people, thirstiness))} {formatNumber(liters)}
</span>{" "} </span>{" "}
liter liter
</p> </p>
<p className={styles.or}>eller</p> <p className={styles.or}>eller</p>
<p> <p>
<span className={styles.big}> <span className={styles.big}>
{formatNumber(calculateBottles(people, thirstiness))} {formatNumber(bottles)}
</span>{" "} </span>{" "}
flasker (1,5L) {bottles === 1 ? "flaske" : "flasker"} (1,5L)
</p> </p>
</div> </div>
<div className={styles.results}> <div className={styles.results}>
<p> <p>
<span className={styles.big}> <span className={styles.big}>
{formatNumber(calculatePizzaSlices(people, hungriness))} {formatNumber(pizzaSlices)}
</span>{" "} </span>{" "}
pizzastykker {pizzaSlices === 1 ? "pizzastykke" : "pizzastykker"}
</p> </p>
<p className={styles.or}>eller</p> <p className={styles.or}>eller</p>
<p> <p>
<span className={styles.big}> <span className={styles.big}>
{formatNumber(calculatePizzas(people, hungriness))} {formatNumber(pizzas)}
</span>{" "} </span>{" "}
store pizzaer {pizzas === 1 ? "stor pizza" : "store pizzaer"}
</p> </p>
</div> </div>
</div> </div>