From ec37a08214a1d91c58f0d1c06d643f9e70530057 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 1 Oct 2022 14:34:07 -0500 Subject: [PATCH] Focus ring --- components/Page.tsx | 14 ++++++++++---- fresh.gen.ts | 40 ++++++++++++++++++++-------------------- routes/login.tsx | 3 +++ routes/register.tsx | 1 + twind.config.ts | 33 +++++++++++++++++++++++---------- 5 files changed, 57 insertions(+), 34 deletions(-) diff --git a/components/Page.tsx b/components/Page.tsx index acf3444..0597465 100644 --- a/components/Page.tsx +++ b/components/Page.tsx @@ -9,12 +9,18 @@ export function Page(props: JSX.HTMLAttributes) {
diff --git a/fresh.gen.ts b/fresh.gen.ts index 48c1e64..4d6bd63 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -2,26 +2,26 @@ // This file SHOULD be checked into source version control. // This file is automatically updated during development when running `dev.ts`. -import config from "@/deno.json" assert { type: "json" }; -import * as $0 from "@/routes/[name].tsx"; -import * as $1 from "@/routes/_404.tsx"; -import * as $2 from "@/routes/_500.tsx"; -import * as $3 from "@/routes/_middleware.ts"; -import * as $4 from "@/routes/about.tsx"; -import * as $5 from "@/routes/api/joke.ts"; -import * as $6 from "@/routes/api/random-uuid.ts"; -import * as $7 from "@/routes/countdown.tsx"; -import * as $8 from "@/routes/github/[username].tsx"; -import * as $9 from "@/routes/index.tsx"; -import * as $10 from "@/routes/login.tsx"; -import * as $11 from "@/routes/note.tsx"; -import * as $12 from "@/routes/note/[id].tsx"; -import * as $13 from "@/routes/note/create.tsx"; -import * as $14 from "@/routes/register.tsx"; -import * as $15 from "@/routes/route-config-example.tsx"; -import * as $16 from "@/routes/search.tsx"; -import * as $$0 from "@/islands/Countdown.tsx"; -import * as $$1 from "@/islands/Counter.tsx"; +import config from "./deno.json" assert { type: "json" }; +import * as $0 from "./routes/[name].tsx"; +import * as $1 from "./routes/_404.tsx"; +import * as $2 from "./routes/_500.tsx"; +import * as $3 from "./routes/_middleware.ts"; +import * as $4 from "./routes/about.tsx"; +import * as $5 from "./routes/api/joke.ts"; +import * as $6 from "./routes/api/random-uuid.ts"; +import * as $7 from "./routes/countdown.tsx"; +import * as $8 from "./routes/github/[username].tsx"; +import * as $9 from "./routes/index.tsx"; +import * as $10 from "./routes/login.tsx"; +import * as $11 from "./routes/note.tsx"; +import * as $12 from "./routes/note/[id].tsx"; +import * as $13 from "./routes/note/create.tsx"; +import * as $14 from "./routes/register.tsx"; +import * as $15 from "./routes/route-config-example.tsx"; +import * as $16 from "./routes/search.tsx"; +import * as $$0 from "./islands/Countdown.tsx"; +import * as $$1 from "./islands/Counter.tsx"; const manifest = { routes: { diff --git a/routes/login.tsx b/routes/login.tsx index a2203fa..8053eaa 100644 --- a/routes/login.tsx +++ b/routes/login.tsx @@ -3,6 +3,9 @@ import { Page } from "../components/Page.tsx"; export default function Login() { return ( +

+ Log in to your account +

diff --git a/routes/register.tsx b/routes/register.tsx index c9982af..e25ceac 100644 --- a/routes/register.tsx +++ b/routes/register.tsx @@ -68,6 +68,7 @@ function RegistrationForm(props?: RegistrationError | null) { console.log(props); return ( +

Register your account

{props != null && (

diff --git a/twind.config.ts b/twind.config.ts index a7a698d..6861b54 100644 --- a/twind.config.ts +++ b/twind.config.ts @@ -2,23 +2,36 @@ import { Options } from "$fresh/plugins/twind.ts"; import { apply } from "twind"; import { css } from "twind/css"; -const button = apply( - "bg-blue(400 500(hover:& focus:&) dark:(600 700(hover:& focus:&))) px-4 py-2 rounded cursor-pointer ring(focus:& current)", -); +const focusRing = apply`focus:outline-main`; -const input = apply( - "rounded bg-gray(200 300(hover:& focus:&) dark:(800 700(hover:& focus:&))) px-4 py-2 ring(focus:& current)", -); +const button = apply`${focusRing} + bg-blue(400 500(hover:& focus:&) dark:(600 700(hover:& focus:&))) px-4 py-2 rounded cursor-pointer +`; + +const input = apply` + ${focusRing} rounded bg-gray(200 300(hover:& focus:&) dark:(800 700(hover:& focus:&))) px-4 py-2`; export default { selfURL: import.meta.url, + + theme: { + outline: { + main: ["2px solid currentColor", "1px"], + }, + extend: { + spacing: { + 128: "32rem", + 144: "36rem", + }, + }, + }, preflight: (preflight) => css(preflight, { - body: apply("bg-white text-black dark:(bg-gray-900 text-white)"), + "body,html": apply("bg-white text-black dark:(bg-gray-900 text-white)"), + "::-moz-focus-inner": { border: 0 }, "body input, body textarea": input, "body button, body input[type=submit]": button, - "body a": apply( - "text-blue(600 700(hover:&) dark:(400 300(hover:&))", - ), + "body a": + apply`rounded ${focusRing} text-blue(600 700(hover:&) dark:(400 300(hover:&))`, }), } as Options;