feat: add context information to render function (#46)

This commit is contained in:
Luca Casonato
2021-08-06 18:08:48 +02:00
committed by GitHub
parent 3bce2fb8d3
commit 0777c1c7ba
9 changed files with 116 additions and 61 deletions
+20 -18
View File
@@ -19,23 +19,25 @@ export default function Home() {
function Counter() {
const [count, setCount] = useState(0);
return <div class={tw`mt-4 border rounded p-4 text-center`}>
<p class={tw`text-lg font-medium`}>Current count: {count}</p>
<div class={tw`flex gap-2 mt-4 justify-center`}>
<RoundedButton
type="button"
onClick={() => setCount(count - 1)}
disabled={!IS_BROWSER}
>
<IconMinus />
</RoundedButton>
<RoundedButton
type="button"
onClick={() => setCount(count + 1)}
disabled={!IS_BROWSER}
>
<IconPlus />
</RoundedButton>
return (
<div class={tw`mt-4 border rounded p-4 text-center`}>
<p class={tw`text-lg font-medium`}>Current count: {count}</p>
<div class={tw`flex gap-2 mt-4 justify-center`}>
<RoundedButton
type="button"
onClick={() => setCount(count - 1)}
disabled={!IS_BROWSER}
>
<IconMinus />
</RoundedButton>
<RoundedButton
type="button"
onClick={() => setCount(count + 1)}
disabled={!IS_BROWSER}
>
<IconPlus />
</RoundedButton>
</div>
</div>
</div>;
);
}
+7 -5
View File
@@ -15,11 +15,13 @@ export default function ModuleInfoPage({ params }: PageProps) {
}
const { latest, versions } = info;
return <p>
The module `{params.module}` has {versions.length} versions, with {latest}
{" "}
being the most recent.
</p>;
return (
<p>
The module `{params.module}` has {versions.length} versions, with {latest}
{" "}
being the most recent.
</p>
);
}
interface ModuleInfo {