Port navigation.

This commit is contained in:
Paul
2021-06-19 15:29:04 +01:00
parent 5aa8f30e14
commit 5b77ed439f
25 changed files with 1341 additions and 42 deletions

View File

@@ -2,11 +2,17 @@ import { useState } from "preact/hooks";
const counts: { [key: string]: number } = {};
export default function PaintCounter() {
export default function PaintCounter({ small }: { small?: boolean }) {
if (import.meta.env.PROD) return null;
const [uniqueId] = useState('' + Math.random());
const count = counts[uniqueId] ?? 0;
counts[uniqueId] = count + 1;
return (
<span>Painted {count + 1} time(s).</span>
<span>
{ small ? <>P: { count + 1 }</> : <>
Painted {count + 1} time(s).
</> }
</span>
)
}