feat(one_shot): some deno boilerplate

This commit is contained in:
rvcas
2023-03-10 12:43:53 -05:00
committed by Lucas
parent 7ea8aeda01
commit ab1ee17ad4
20 changed files with 385 additions and 60 deletions

View File

@@ -0,0 +1,17 @@
import { useState } from "preact/hooks";
import { Button } from "../components/Button.tsx";
interface CounterProps {
start: number;
}
export default function Counter(props: CounterProps) {
const [count, setCount] = useState(props.start);
return (
<div class="flex gap-2 w-full">
<p class="flex-grow-1 font-bold text-xl">{count}</p>
<Button onClick={() => setCount(count - 1)}>-1</Button>
<Button onClick={() => setCount(count + 1)}>+1</Button>
</div>
);
}