From ea2aa7c76c4c5361e493a27584d526daa366f3d4 Mon Sep 17 00:00:00 2001 From: dswbx Date: Sat, 15 Mar 2025 16:44:58 +0100 Subject: [PATCH] fix react example styling --- examples/react/src/App.tsx | 1 - examples/react/src/routes/_index.tsx | 128 +++++++++++++-------------- examples/react/src/routes/admin.tsx | 1 + examples/react/src/styles.css | 39 ++++---- 4 files changed, 85 insertions(+), 84 deletions(-) diff --git a/examples/react/src/App.tsx b/examples/react/src/App.tsx index e122556..2e2a25b 100644 --- a/examples/react/src/App.tsx +++ b/examples/react/src/App.tsx @@ -8,7 +8,6 @@ import IndexPage from "~/routes/_index"; const Admin = lazy(() => import("~/routes/admin")); import { Center } from "~/components/Center"; import { ClientProvider } from "bknd/client"; -import "bknd/dist/styles.css"; export default function () { const [app, setApp] = useState(undefined); diff --git a/examples/react/src/routes/_index.tsx b/examples/react/src/routes/_index.tsx index 227ab5f..4f57317 100644 --- a/examples/react/src/routes/_index.tsx +++ b/examples/react/src/routes/_index.tsx @@ -12,73 +12,72 @@ export default function IndexPage({ app }: { app: App }) { const total = todos?.body.meta.total || 0; return ( -
-
-
- bknd -

local

-
+
+
+ bknd +

local

+
-
-

- What's next? ({total}) -

-
- {total > limit && ( -
- {total - limit} more todo(s) hidden -
- )} -
- {todos?.reverse().map((todo) => ( -
-
- { - await $q.update({ done: !todo.done }, todo.id); - }} - /> -
{todo.title}
-
- -
- ))} +
+

+ What's next? ({total}) +

+
+ {total > limit && ( +
+ {total - limit} more todo(s) hidden
-
t.id).join()} - action={async (formData: FormData) => { - const title = formData.get("title") as string; - await $q.create({ title }); - }} - > - - -
+ )} +
+ {todos?.reverse().map((todo) => ( +
+
+ { + await $q.update({ done: !todo.done }, todo.id); + }} + /> +
{todo.title}
+
+ +
+ ))}
+
t.id).join()} + action={async (formData: FormData) => { + const title = formData.get("title") as string; + await $q.create({ title }); + }} + > + + +
+
-
- Go to Admin ➝ - {/*
+
+ Go to Admin ➝ + {/*
{user ? (

Authenticated as {user.email} @@ -87,8 +86,7 @@ export default function IndexPage({ app }: { app: App }) { Login )}

*/} -
-
-
+ + ); } diff --git a/examples/react/src/routes/admin.tsx b/examples/react/src/routes/admin.tsx index 0f390af..efb5d12 100644 --- a/examples/react/src/routes/admin.tsx +++ b/examples/react/src/routes/admin.tsx @@ -1,5 +1,6 @@ import { Admin, type BkndAdminProps } from "bknd/ui"; import type { App } from "bknd"; +import "bknd/dist/styles.css"; export default function AdminPage({ app, diff --git a/examples/react/src/styles.css b/examples/react/src/styles.css index 3f4f365..4e0bdd8 100644 --- a/examples/react/src/styles.css +++ b/examples/react/src/styles.css @@ -1,25 +1,28 @@ -/* @todo: currently not working nicely */ -#app { - @import "tailwindcss"; +@import "tailwindcss"; + +:root { + --background: #ffffff; + --foreground: #171717; +} + +@media (prefers-color-scheme: dark) { :root { - --background: #ffffff; - --foreground: #171717; + --background: #0a0a0a; + --foreground: #ededed; } +} - @media (prefers-color-scheme: dark) { - :root { - --background: #0a0a0a; - --foreground: #ededed; - } - } +@theme { + --color-background: var(--background); + --color-foreground: var(--foreground); +} - @theme { - --color-background: var(--background); - --color-foreground: var(--foreground); - } - - width: 100%; - min-height: 100dvh; +body { @apply bg-background text-foreground flex; font-family: Arial, Helvetica, sans-serif; } + +#root { + width: 100%; + min-height: 100dvh; +}