2023-07-26 13:47:01 +02:00
|
|
|
import type { Signal } from "@preact/signals";
|
2023-07-30 19:40:39 +02:00
|
|
|
import { Button } from "@components/Button.tsx";
|
2023-07-26 13:47:01 +02:00
|
|
|
|
|
|
|
interface CounterProps {
|
|
|
|
count: Signal<number>;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Counter(props: CounterProps) {
|
|
|
|
return (
|
2023-07-30 19:40:39 +02:00
|
|
|
<div class="flex gap-2 items-center">
|
|
|
|
<Button onClick={() => props.count.value -= 1}>-</Button>
|
2023-07-26 13:47:01 +02:00
|
|
|
<p class="text-3xl">{props.count}</p>
|
2023-07-30 19:40:39 +02:00
|
|
|
<Button onClick={() => props.count.value += 1}>+</Button>
|
2023-07-26 13:47:01 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|