From dd65692bf6d38b99d9723259ddebdbcaeddf0ce5 Mon Sep 17 00:00:00 2001 From: kLiHz <66966137+kLiHz@users.noreply.github.com> Date: Wed, 1 May 2024 17:33:06 +0800 Subject: [PATCH 1/6] Bump to Twind v1 https://fresh.deno.dev/docs/examples/using-twind-v1 --- fresh.config.ts | 2 +- twind.config.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fresh.config.ts b/fresh.config.ts index fd48d1b..e1ebe91 100644 --- a/fresh.config.ts +++ b/fresh.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "$fresh/server.ts"; -import twindPlugin from "$fresh/plugins/twind.ts"; +import twindPlugin from "$fresh/plugins/twindv1.ts"; import twindConfig from "./twind.config.ts"; export default defineConfig({ plugins: [twindPlugin(twindConfig)], diff --git a/twind.config.ts b/twind.config.ts index 2a7ac27..b58b8f8 100644 --- a/twind.config.ts +++ b/twind.config.ts @@ -1,5 +1,10 @@ -import { Options } from "$fresh/plugins/twind.ts"; +import { defineConfig, Preset } from "https://esm.sh/@twind/core@1.1.3"; +import presetTailwind from "https://esm.sh/@twind/preset-tailwind@1.1.4"; +import presetAutoprefix from "https://esm.sh/@twind/preset-autoprefix@1.0.7"; export default { + ...defineConfig({ + presets: [presetTailwind() as Preset, presetAutoprefix()], + }), selfURL: import.meta.url, -} as Options; +}; From 1da2c46c3e4141b25324b62e18a0c1bf0a1b7713 Mon Sep 17 00:00:00 2001 From: kLiHz <66966137+kLiHz@users.noreply.github.com> Date: Wed, 1 May 2024 17:46:24 +0800 Subject: [PATCH 2/6] Update imports to use import map --- twind.config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/twind.config.ts b/twind.config.ts index b58b8f8..8c5b4d2 100644 --- a/twind.config.ts +++ b/twind.config.ts @@ -1,6 +1,6 @@ -import { defineConfig, Preset } from "https://esm.sh/@twind/core@1.1.3"; -import presetTailwind from "https://esm.sh/@twind/preset-tailwind@1.1.4"; -import presetAutoprefix from "https://esm.sh/@twind/preset-autoprefix@1.0.7"; +import { defineConfig, Preset } from "@twind/core"; +import presetTailwind from "@twind/preset-tailwind"; +import presetAutoprefix from "@twind/preset-autoprefix"; export default { ...defineConfig({ From 50180f80e97b2444df35c6740d3f3565d16acf04 Mon Sep 17 00:00:00 2001 From: kLiHz <66966137+kLiHz@users.noreply.github.com> Date: Wed, 1 May 2024 18:09:46 +0800 Subject: [PATCH 3/6] Remove old twind imports in deno.json --- deno.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/deno.json b/deno.json index b951d2c..f6a416e 100644 --- a/deno.json +++ b/deno.json @@ -16,8 +16,6 @@ "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1", "@preact/signals": "https://esm.sh/*@preact/signals@1.2.2", "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1", - "twind": "https://esm.sh/twind@0.16.19", - "twind/": "https://esm.sh/twind@0.16.19/", "$gfm": "https://deno.land/x/gfm@0.1.28/mod.ts", "$prism": "https://esm.sh/prismjs@1.29.0", "$prism/": "https://esm.sh/prismjs@1.29.0/", From eb0dc290979973716dde281264944147e56034c1 Mon Sep 17 00:00:00 2001 From: kLiHz <66966137+kLiHz@users.noreply.github.com> Date: Thu, 2 May 2024 18:52:12 +0800 Subject: [PATCH 4/6] Dark theme support --- components/Footer.tsx | 2 +- components/Header.tsx | 4 ++-- components/Page.tsx | 2 +- islands/CopyButton.tsx | 15 ++++++++++----- routes/[id]/index.tsx | 39 +++++++++++++++++++++++++-------------- routes/index.tsx | 10 +++++----- 6 files changed, 44 insertions(+), 28 deletions(-) diff --git a/components/Footer.tsx b/components/Footer.tsx index 5d2fe47..e2c90bb 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -15,7 +15,7 @@ export function Footer() {
-

Deno

+

Deno

diff --git a/components/Header.tsx b/components/Header.tsx index 8205ce5..3b432ba 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -6,10 +6,10 @@ export function Header(props: { noSubtitle?: boolean }) { logo - + Deno - + by example diff --git a/components/Page.tsx b/components/Page.tsx index 6007931..e3cf750 100644 --- a/components/Page.tsx +++ b/components/Page.tsx @@ -10,7 +10,7 @@ export function Page(props: { }) { return (
diff --git a/islands/CopyButton.tsx b/islands/CopyButton.tsx index 38615a9..a39c8b4 100644 --- a/islands/CopyButton.tsx +++ b/islands/CopyButton.tsx @@ -8,10 +8,15 @@ function Copy() { fill="none" xmlns="http://www.w3.org/2000/svg" > - + + + + ); } @@ -20,7 +25,7 @@ export default function CopyButton(props: { text: string }) { return (
-

{example.title}

+

+ {example.title} +

Edit @@ -154,14 +156,14 @@ export default function ExamplePage(props: PageProps) {
{example.run && ( <> -

+

Run{" "} this example {" "} locally using the Deno CLI:

-
+                
                   {example.run.startsWith("deno")
                     ? example.run.replace("", url)
                     : "deno run " + example.run.replace("", url)}
@@ -170,7 +172,7 @@ export default function ExamplePage(props: PageProps) {
             )}
             {example.playground && (
               
-

+

Try this example in a Deno Deploy playground:

@@ -192,7 +194,7 @@ export default function ExamplePage(props: PageProps) {