feat: twind plugin (#513)

This adds a first-party twind plugin to use twind for styling.
This commit is contained in:
Luca Casonato
2022-08-09 21:41:11 +02:00
committed by GitHub
parent fd4e2bbe17
commit 660e0f5fef
20 changed files with 296 additions and 238 deletions
+2 -5
View File
@@ -2,7 +2,6 @@
import { h } from "preact";
import { useState } from "preact/hooks";
import { IS_BROWSER } from "$fresh/runtime.ts";
import { tw } from "@twind";
import { RoundedButton } from "../components/Button.tsx";
import { IconMinus, IconPlus } from "../components/Icons.tsx";
@@ -13,9 +12,7 @@ interface CounterProps {
export default function Counter(props: CounterProps) {
const [count, setCount] = useState(props.start);
return (
<div
class={tw`bg-gray-100 p-4 border border-gray-200 flex items-center justify-around`}
>
<div class="bg-gray-100 p-4 border border-gray-200 flex items-center justify-around">
<RoundedButton
title="Subtract 1"
onClick={() => setCount(count - 1)}
@@ -23,7 +20,7 @@ export default function Counter(props: CounterProps) {
>
<IconMinus />
</RoundedButton>
<div class={tw`text-3xl tabular-nums`}>{count}</div>
<div class="text-3xl tabular-nums">{count}</div>
<RoundedButton
title="Add 1"
onClick={() => setCount(count + 1)}