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)}
+2 -3
View File
@@ -2,7 +2,6 @@
/** @jsxFrag Fragment */
import { Fragment, h } from "preact";
import { useEffect, useRef, useState } from "preact/hooks";
import { tw } from "@twind";
import { Spring, WaveTank } from "../components/WaveTank.ts";
function easeInCirc(x: number) {
@@ -102,7 +101,7 @@ function LemonDrop() {
viewBox="0 0 100 300"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class={tw`mt-36`}
class="mt-36"
role="img"
aria-label="Fresh logo"
>
@@ -130,7 +129,7 @@ function LemonDrop() {
height="100px"
viewBox="0 0 100 100"
preserveAspectRatio="none"
class={tw`-mt-5`}
class="-mt-5"
>
<polygon
points={springsPath}