commit
Make this my own lol
diff --git a/package.json b/package.json
index 6ead48a..ac50180 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"@simplewebauthn/server": "^14.0.2",
"hono": "^4.13.8",
"jose": "^6.2.12",
+ "pixelarticons": "^2.4.1",
"uqr": "^0.1.3"
},
"devDependencies": {
diff --git a/public/static/favicon.svg b/public/static/favicon.svg
new file mode 100644
index 0000000..1c6419e
--- /dev/null
+++ b/public/static/favicon.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+ <defs>
+ <linearGradient id="trans" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0%" stop-color="#5BCEFA"/>
+ <stop offset="25%" stop-color="#F5A9B8"/>
+ <stop offset="50%" stop-color="#FFFFFF"/>
+ <stop offset="75%" stop-color="#F5A9B8"/>
+ <stop offset="100%" stop-color="#5BCEFA"/>
+ </linearGradient>
+ </defs>
+ <rect width="24" height="24" rx="5" fill="#07050a"/>
+ <path d="M5 8h14v2H5zm0 12h14v2H5zM3 10h2v10H3zm16 0h2v10h-2zM7 4h2v4H7zm2-2h6v2H9zm6 2h2v4h-2z" fill="url(#trans)"/>
+</svg>
diff --git a/public/static/style.css b/public/static/style.css
index 15c7f9a..0ee7903 100644
--- a/public/static/style.css
+++ b/public/static/style.css
@@ -3,44 +3,28 @@
* Licensed under the DASL-1.2 Licence.
* See LICENCE.md in the project root for full licence information.
*/
-
:root {
- --bg: #060d18;
- --surface: #0d1a2c;
- --surface-2: #13243b;
- --border: #22375a;
- --text: #e6edf7;
- --muted: #8ea2bf;
- --accent: #8ab4ff;
- --accent-text: #06101f;
- --ok: #5fd39a;
- --ok-bg: rgba(95, 211, 154, 0.12);
- --danger: #ff7a8a;
- --danger-bg: rgba(255, 122, 138, 0.12);
- --focus: #b9d2ff;
- --radius: 10px;
+ --bg: #07050a;
+ --surface: #100a10;
+ --surface-2: #1a1016;
+ --border: #34141c;
+ --border-strong: #5c1c28;
+ --text: #ece3e6;
+ --muted: #9c848c;
+ --accent: #9c1f34;
+ --accent-strong: #c22a44;
+ --accent-text: #fff2f2;
+ --ok: #5f9e78;
+ --ok-bg: rgba(95, 158, 120, 0.12);
+ --danger: #ff4d5e;
+ --danger-bg: rgba(255, 77, 94, 0.12);
+ --focus: #e23a52;
+ --focus-glow: rgba(226, 58, 82, 0.35);
+ --radius: 8px;
+ --display-font: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
color-scheme: dark;
}
-@media (prefers-color-scheme: light) {
- :root {
- --bg: #f4f6fb;
- --surface: #ffffff;
- --surface-2: #eef2f9;
- --border: #d4dcea;
- --text: #0f1a2b;
- --muted: #5a6b85;
- --accent: #2456c9;
- --accent-text: #ffffff;
- --ok: #16794a;
- --ok-bg: rgba(22, 121, 74, 0.1);
- --danger: #c02a3d;
- --danger-bg: rgba(192, 42, 61, 0.08);
- --focus: #2456c9;
- color-scheme: light;
- }
-}
-
*,
*::before,
*::after {
@@ -53,13 +37,22 @@ html {
body {
margin: 0;
- background: var(--bg);
+ min-height: 100vh;
+ background:
+ radial-gradient(ellipse 900px 480px at 50% -12%, rgba(156, 31, 52, 0.16), transparent 60%),
+ radial-gradient(ellipse 700px 500px at 100% 110%, rgba(92, 28, 40, 0.12), transparent 60%),
+ var(--bg);
+ background-attachment: fixed;
color: var(--text);
font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a {
- color: var(--accent);
+ color: var(--accent-strong);
+}
+
+a:hover {
+ color: var(--focus);
}
code {
@@ -69,12 +62,16 @@ code {
}
h1 {
- font-size: 1.5rem;
+ font-family: var(--display-font);
+ font-size: 1.6rem;
+ letter-spacing: 0.015em;
margin: 0 0 0.75rem;
}
h2 {
- font-size: 1.1rem;
+ font-family: var(--display-font);
+ font-size: 1.15rem;
+ letter-spacing: 0.01em;
margin: 0 0 0.5rem;
}
@@ -99,13 +96,17 @@ h2 {
gap: 1rem;
flex-wrap: wrap;
padding: 0.75rem 16px;
+ background: linear-gradient(180deg, var(--surface), #0b070a);
border-bottom: 1px solid var(--border);
- background: var(--surface);
+ box-shadow: 0 1px 0 rgba(156, 31, 52, 0.25);
}
.brand {
color: var(--text);
- font-weight: 650;
+ font-family: var(--display-font);
+ font-size: 1.1rem;
+ font-weight: 600;
+ letter-spacing: 0.04em;
text-decoration: none;
}
@@ -131,10 +132,13 @@ main.narrow {
.card,
.panel {
+ position: relative;
background: var(--surface);
border: 1px solid var(--border);
+ border-top: 1px solid var(--border-strong);
border-radius: var(--radius);
padding: 1.25rem;
+ box-shadow: 0 16px 32px -20px rgba(0, 0, 0, 0.8);
}
.panel {
@@ -143,23 +147,34 @@ main.narrow {
.tabs {
display: flex;
- gap: 0.25rem;
+ gap: 0.4rem;
overflow-x: auto;
- margin-bottom: 1rem;
- border-bottom: 1px solid var(--border);
+ margin-bottom: 1.25rem;
+ padding-bottom: 0.25rem;
}
.tabs a {
- padding: 0.5rem 0.75rem;
+ padding: 0.45rem 0.9rem;
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ background: var(--surface-2);
color: var(--muted);
text-decoration: none;
white-space: nowrap;
- border-bottom: 2px solid transparent;
+ font-weight: 550;
+ font-size: 0.9rem;
+ transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
-.tabs a.active {
+.tabs a:hover {
+ border-color: var(--accent-strong);
color: var(--text);
- border-bottom-color: var(--accent);
+}
+
+.tabs a.active {
+ background: linear-gradient(180deg, var(--accent-strong), var(--accent) 85%);
+ border-color: var(--border-strong);
+ color: var(--accent-text);
}
/* --- forms ------------------------------------------------------------------- */
@@ -216,6 +231,8 @@ input:disabled {
:focus-visible {
outline: 2px solid var(--focus);
outline-offset: 2px;
+ box-shadow: 0 0 0 5px var(--focus-glow);
+ border-radius: 4px;
}
fieldset {
@@ -247,7 +264,12 @@ legend {
margin-top: 0.3rem;
}
-button {
+button,
+.btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.4rem;
padding: 0.55rem 1rem;
border: 1px solid var(--border);
border-radius: 8px;
@@ -255,11 +277,21 @@ button {
color: var(--text);
font: inherit;
font-weight: 550;
+ text-decoration: none;
cursor: pointer;
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
-button:hover:not(:disabled) {
- border-color: var(--accent);
+.icon {
+ width: 1.1em;
+ height: 1.1em;
+ flex-shrink: 0;
+}
+
+button:hover:not(:disabled),
+.btn:hover {
+ border-color: var(--accent-strong);
+ color: var(--text);
}
button:disabled {
@@ -267,34 +299,51 @@ button:disabled {
cursor: not-allowed;
}
-button.primary {
- background: var(--accent);
- border-color: var(--accent);
+button.primary,
+.btn.primary {
+ background: linear-gradient(180deg, var(--accent-strong), var(--accent) 85%);
+ border-color: var(--border-strong);
color: var(--accent-text);
}
-button.danger {
+button.primary:hover:not(:disabled),
+.btn.primary:hover {
+ border-color: var(--focus);
+ box-shadow: 0 0 0 3px var(--focus-glow);
+ color: var(--accent-text);
+}
+
+button.danger,
+.btn.danger {
color: var(--danger);
}
-button.small {
+button.small,
+.btn.small {
padding: 0.3rem 0.65rem;
font-size: 0.85rem;
}
-button.wide {
+button.wide,
+.btn.wide {
width: 100%;
}
-button.link {
+button.link,
+.btn.link {
padding: 0;
border: 0;
background: none;
- color: var(--accent);
+ color: var(--accent-strong);
font-weight: inherit;
text-decoration: underline;
}
+.btn.link:hover {
+ border-color: transparent;
+ color: var(--focus);
+}
+
form.inline {
display: inline;
}
@@ -478,6 +527,11 @@ table.compact td {
letter-spacing: 0.05em;
}
+::selection {
+ background: var(--accent);
+ color: var(--accent-text);
+}
+
@media (max-width: 560px) {
.rows > li {
flex-wrap: wrap;
diff --git a/src/lib/guards.tsx b/src/lib/guards.tsx
index a8c4742..f9fef7a 100644
--- a/src/lib/guards.tsx
+++ b/src/lib/guards.tsx
@@ -9,6 +9,7 @@ import { TTL, issuerOrigin, now, type AppContext, type AppEnv } from "../env";
import { timingSafeEqualStr } from "./crypto";
import { form, safeReturn } from "./http";
import { render } from "../views/layout";
+import { Icon } from "../views/ui";
function wantsJson(c: AppContext): boolean {
return (c.req.header("content-type") ?? "").includes("application/json");
@@ -53,7 +54,10 @@ export const requireAdmin = createMiddleware<AppEnv>(async (c, next) => {
<h1>Admins only</h1>
<p class="muted">Your account isn't in the admin group for this server.</p>
<p>
- <a href="/account">Back to your account</a>
+ <a class="btn primary" href="/account">
+ <Icon name="arrow-left" />
+ Back to your account
+ </a>
</p>
</div>,
);
diff --git a/src/oidc/endpoints.tsx b/src/oidc/endpoints.tsx
index 647276b..aeb8135 100644
--- a/src/oidc/endpoints.tsx
+++ b/src/oidc/endpoints.tsx
@@ -15,7 +15,7 @@ import { publicJwks } from "../data/keys";
import { endSession } from "../data/sessions";
import { getUser, groupsFor } from "../data/users";
import { render } from "../views/layout";
-import { Csrf } from "../views/ui";
+import { Csrf, Icon } from "../views/ui";
import {
SUPPORTED_CLAIMS,
SUPPORTED_SCOPES,
@@ -197,7 +197,7 @@ async function authorize(c: AppContext) {
<button type="submit" class="wide">Sign in as someone else</button>
</form>
<p class="small">
- <a href={denied.toString()}>Back to {client.name}</a>
+ <a class="btn wide" href={denied.toString()}>Back to {client.name}</a>
</p>
</div>,
);
@@ -506,11 +506,14 @@ async function endSessionRequest(c: AppContext) {
<input type="hidden" name="client_id" value={clientId ?? ""} />
<input type="hidden" name="post_logout_redirect_uri" value={params.post_logout_redirect_uri ?? ""} />
<input type="hidden" name="state" value={params.state ?? ""} />
- <button type="submit" class="primary wide">Sign out</button>
+ <button type="submit" class="primary wide">
+ <Icon name="logout" />
+ Sign out
+ </button>
</form>
{returnTo && (
<p class="small">
- <a href={returnTo}>Stay signed in and go back</a>
+ <a class="btn wide" href={returnTo}>Stay signed in and go back</a>
</p>
)}
</div>,
diff --git a/src/routes/account.tsx b/src/routes/account.tsx
index 4498af8..7eb67bc 100644
--- a/src/routes/account.tsx
+++ b/src/routes/account.tsx
@@ -35,7 +35,7 @@ import {
type UserRow,
} from "../data/users";
import { render } from "../views/layout";
-import { Csrf, ErrorNote, Field, Flash, Section, date, describeAgent, relative } from "../views/ui";
+import { Csrf, ErrorNote, Field, Flash, Icon, Section, date, describeAgent, relative } from "../views/ui";
export const account = new Hono<AppEnv>();
@@ -136,7 +136,10 @@ async function accountPage(c: AppContext, opts: { error?: string; status?: 400 }
)}
<form id="passkey-add" class="inline-edit">
<input type="text" name="name" placeholder="Name, e.g. Phone" maxlength={60} aria-label="New passkey name" />
- <button type="submit" class="primary">Add a passkey</button>
+ <button type="submit" class="primary">
+ <Icon name="key" />
+ Add a passkey
+ </button>
</form>
</Section>
@@ -368,10 +371,13 @@ async function totpSetupPage(c: AppContext, error?: string) {
<form method="post" action="/account/totp/confirm" class="stack">
<Csrf token={c.get("session")!.csrf} />
<Field label="Code" name="code" required inputmode="numeric" autocomplete="one-time-code" maxlength={7} autofocus />
- <button type="submit" class="primary wide">Turn on</button>
+ <button type="submit" class="primary wide">
+ <Icon name="shield" />
+ Turn on
+ </button>
</form>
<p class="small">
- <a href="/account">Cancel</a>
+ <a class="btn wide" href="/account">Cancel</a>
</p>
</div>,
);
diff --git a/src/routes/admin.tsx b/src/routes/admin.tsx
index e164297..fd73a16 100644
--- a/src/routes/admin.tsx
+++ b/src/routes/admin.tsx
@@ -51,7 +51,7 @@ import {
setUserGroups,
} from "../data/users";
import { render } from "../views/layout";
-import { Csrf, ErrorNote, Field, Flash, Section, date, relative } from "../views/ui";
+import { Csrf, ErrorNote, Field, Flash, Icon, Section, date, relative } from "../views/ui";
export const admin = new Hono<AppEnv>();
@@ -117,7 +117,7 @@ function notFound(c: AppContext, what: string) {
c,
{ title: "Not found", tab: "", status: 404 },
<p>
- That {what} doesn't exist. <a href="/admin">Back</a>
+ That {what} doesn't exist. <a class="btn small" href="/admin">Back</a>
</p>,
);
}
@@ -145,8 +145,8 @@ async function usersPage(c: AppContext, error?: string, values: Record<string, s
{users.map((u) => (
<tr>
<td>
- <a href={`/admin/users/${encodeURIComponent(u.id)}`}>
- <strong>{u.name ?? u.username}</strong>
+ <a class="btn small" href={`/admin/users/${encodeURIComponent(u.id)}`}>
+ {u.name ?? u.username}
</a>
<br />
<small class="muted">@{u.username}</small>
@@ -194,7 +194,10 @@ async function usersPage(c: AppContext, error?: string, values: Record<string, s
/>
</details>
<div>
- <button type="submit" class="primary">Create user</button>
+ <button type="submit" class="primary">
+ <Icon name="user-plus" />
+ Create user
+ </button>
</div>
</form>
</Section>
@@ -252,7 +255,7 @@ async function userPage(
{ title: `@${user.username}`, tab: "/admin/users", error: opts.error, status: opts.error ? 400 : undefined },
<>
<p>
- <a href="/admin/users">← All users</a>
+ <a class="btn small" href="/admin/users">← All users</a>
</p>
<h1>
{user.name ?? user.username} <small class="muted">@{user.username}</small>
@@ -323,7 +326,10 @@ async function userPage(
<option value="604800">7 days</option>
</select>
</label>
- <button type="submit" class="primary">{openLink ? "Replace link" : "Create link"}</button>
+ <button type="submit" class="primary">
+ <Icon name="link" />
+ {openLink ? "Replace link" : "Create link"}
+ </button>
</form>
</Section>
@@ -555,7 +561,10 @@ async function groupsPage(c: AppContext, error?: string) {
<Field label="Description" name="description" maxlength={200} autocomplete="off" />
</div>
<div>
- <button type="submit" class="primary">Create group</button>
+ <button type="submit" class="primary">
+ <Icon name="users" />
+ Create group
+ </button>
</div>
</form>
</Section>
@@ -676,8 +685,8 @@ async function clientsPage(c: AppContext, error?: string, raw: Record<string, st
{clients.map((cl) => (
<tr>
<td>
- <a href={`/admin/clients/${encodeURIComponent(cl.id)}`}>
- <strong>{cl.name}</strong>
+ <a class="btn small" href={`/admin/clients/${encodeURIComponent(cl.id)}`}>
+ {cl.name}
</a>
</td>
<td>
@@ -724,7 +733,10 @@ async function clientsPage(c: AppContext, error?: string, raw: Record<string, st
/>
</details>
<div>
- <button type="submit" class="primary">Create application</button>
+ <button type="submit" class="primary">
+ <Icon name="app-windows" />
+ Create application
+ </button>
</div>
</form>
</Section>
@@ -784,7 +796,7 @@ async function clientPage(c: AppContext, id: string, opts: { error?: string; sec
{ title: client.name, tab: "/admin/clients", error: opts.error, status: opts.error ? 400 : undefined },
<>
<p>
- <a href="/admin/clients">← All applications</a>
+ <a class="btn small" href="/admin/clients">← All applications</a>
</p>
<h1>{client.name}</h1>
diff --git a/src/routes/login.tsx b/src/routes/login.tsx
index bba64f8..6ceb441 100644
--- a/src/routes/login.tsx
+++ b/src/routes/login.tsx
@@ -26,7 +26,7 @@ import {
} from "../data/sessions";
import { claimTotpStep, countUsers, getUser, getUserByUsername, setPasswordHash } from "../data/users";
import { render } from "../views/layout";
-import { ErrorNote, Field, Flash } from "../views/ui";
+import { ErrorNote, Field, Flash, Icon } from "../views/ui";
const WINDOW = 15 * 60;
const USER_LIMIT = 10;
@@ -61,6 +61,7 @@ function loginPage(c: AppContext, opts: LoginPageOptions) {
<p class="notice error hidden" id="passkey-error" role="alert"></p>
<button type="button" class="primary wide" id="passkey-signin">
+ <Icon name="key" />
Sign in with a passkey
</button>
@@ -172,11 +173,12 @@ function totpPage(c: AppContext, error?: string) {
autofocus
/>
<button type="submit" class="primary wide">
+ <Icon name="login" />
Continue
</button>
</form>
<p class="muted small">
- <a href="/login">Start over</a>
+ <a class="btn wide" href="/login">Start over</a>
</p>
</div>,
);
@@ -269,6 +271,7 @@ login.get("/login/link/:token", async (c) => {
)}
<form method="post" action={`/login/link/${c.req.param("token")}`}>
<button type="submit" class="primary wide">
+ <Icon name="login" />
Continue
</button>
</form>
diff --git a/src/routes/setup.tsx b/src/routes/setup.tsx
index afb9cd8..f415fbf 100644
--- a/src/routes/setup.tsx
+++ b/src/routes/setup.tsx
@@ -14,7 +14,7 @@ import { cleanText, emailProblem, normaliseUsername, usernameProblem } from "../
import { startSession } from "../data/sessions";
import { countUsers, createFirstAdmin } from "../data/users";
import { render } from "../views/layout";
-import { ErrorNote, Field } from "../views/ui";
+import { ErrorNote, Field, Icon } from "../views/ui";
export const setup = new Hono<AppEnv>();
@@ -26,7 +26,10 @@ function closed(c: AppContext) {
<h1>Setup is done</h1>
<p class="muted">This server already has accounts.</p>
<p>
- <a href="/login">Sign in</a>
+ <a class="btn primary" href="/login">
+ <Icon name="login" />
+ Sign in
+ </a>
</p>
</div>,
);
@@ -61,6 +64,7 @@ function setupPage(c: AppContext, values: Record<string, string> = {}, error?: s
<Field label="Display name" name="name" value={values.name} autocomplete="name" maxlength={100} />
<Field label="Email" name="email" type="email" value={values.email} autocomplete="email" maxlength={254} />
<button type="submit" class="primary wide">
+ <Icon name="user-plus" />
Create admin account
</button>
</form>
diff --git a/src/views/icons.ts b/src/views/icons.ts
new file mode 100644
index 0000000..5bfe792
--- /dev/null
+++ b/src/views/icons.ts
@@ -0,0 +1,30 @@
+/* src/views/icons.ts
+ * Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ * Licensed under the DASL-1.2 Licence.
+ * See LICENCE.md in the project root for full licence information.
+ *
+ * Path data lifted from the `pixelarticons` package (MIT), trimmed to the
+ * handful this app actually uses so it can ship as plain JSX with no runtime
+ * dependency on the package or a font file.
+ */
+
+export const ICONS = {
+ user: ["M9 2h6v2H9zm0 8h6v2H9zm6-6h2v6h-2zM7 4h2v6H7zM4 18h2v4H4zm14 0h2v4h-2zM8 14h8v2H8zm-2 2h2v2H6zm10 0h2v2h-2z"],
+ "user-plus": [
+ "M9 2h6v2H9zm0 8h6v2H9zm6-6h2v6h-2zM7 4h2v6H7zM4 18h2v4H4zm14 0h2v4h-2zM8 14h8v2H8zm-2 2h2v2H6z",
+ "M18 16h2v6h-2z",
+ "M16 18h6v2h-6z",
+ ],
+ users: [
+ "M5 2h6v2H5zm10 0h4v2h-4zM5 10h6v2H5zm10 0h4v2h-4zm4-6h2v6h-2zm-8 0h2v6h-2zM3 4h2v6H3zM0 18h2v4H0zm14 0h2v4h-2zm8 0h2v4h-2zM4 14h8v2H4zm12 0h4v2h-4zM2 16h2v2H2zm10 0h2v2h-2zm8 0h2v2h-2z",
+ ],
+ shield: ["M4 2h16v2H4zM2 4h2v10H2zm18 0h2v10h-2zM4 14h2v2H4zm2 2h2v2H6zm4 4h4v2h-4zm10-6h-2v2h2zm-2 2h-2v2h2zm-2 2h-2v2h2zm-6 0H8v2h2z"],
+ key: ["M11 18H3V16H11V18ZM23 15H21V18H17V16H19V13H21V11H11V8H13V9H23V15ZM3 16H1V8H3V16ZM17 16H15V15H13V16H11V13H17V16ZM9 14H5V10H9V14ZM11 8H3V6H11V8Z"],
+ link: ["M4 6h7v2H4zm0 10h7v2H4zM2 8h2v8H2zm18-2h-7v2h7zm0 10h-7v2h7zm2-8h-2v8h2zM7 11h10v2H7z"],
+ login: ["M2 11h14v2H2zm10-2h2v2h-2z", "M10 7h2v10h-2zm2 6h2v2h-2zM6 2h12v2H6zm0 18h12v2H6zM4 4h2v5H4zm0 11h2v5H4zM18 4h2v16h-2z"],
+ logout: ["M8 11h12v2H8zm8-2h2v2h-2z", "M14 7h2v10h-2zm2 6h2v2h-2zM6 2h12v2H6zm0 18h12v2H6zM4 4h2v16H4zm14 0h2v3h-2zm0 13h2v3h-2z"],
+ "arrow-left": ["M20 11v2H4v-2zM8 13v2H6v-2zm2 2v2H8v-2zm2 2v2h-2v-2zm-4-6V9H6v2z", "M10 15V7H8v8zm2 2V5h-2v12z"],
+ "app-windows": ["M4 3h16v2H4zm0 16h16v2H4zM2 5h2v14H2zm18 0h2v14h-2zM4 7h16v2H4zm8-2h2v2h-2zm4 0h2v2h-2z"],
+} as const;
+
+export type IconName = keyof typeof ICONS;
diff --git a/src/views/layout.tsx b/src/views/layout.tsx
index 17854d8..342e34f 100644
--- a/src/views/layout.tsx
+++ b/src/views/layout.tsx
@@ -7,6 +7,7 @@
import type { Child } from "hono/jsx";
import type { ContentfulStatusCode } from "hono/utils/http-status";
import { siteName, type AppContext } from "../env";
+import { Icon } from "./ui";
interface PageOptions {
title: string;
@@ -27,9 +28,10 @@ export async function render(c: AppContext, opts: PageOptions, body: Child): Pro
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="color-scheme" content="dark light" />
+ <meta name="color-scheme" content="dark" />
<meta name="robots" content="noindex" />
<title>{`${opts.title} · ${site}`}</title>
+ <link rel="icon" type="image/svg+xml" href="/static/favicon.svg" />
<link rel="stylesheet" href="/static/style.css" />
<script src="/static/app.js" defer></script>
</head>
@@ -40,11 +42,20 @@ export async function render(c: AppContext, opts: PageOptions, body: Child): Pro
</a>
{user && (
<nav>
- <a href="/account">Account</a>
- {user.isAdmin && <a href="/admin">Admin</a>}
+ <a class="btn small" href="/account">
+ <Icon name="user" />
+ Account
+ </a>
+ {user.isAdmin && (
+ <a class="btn small" href="/admin">
+ <Icon name="shield" />
+ Admin
+ </a>
+ )}
<form method="post" action="/logout" class="inline">
<input type="hidden" name="_csrf" value={session?.csrf ?? ""} />
- <button type="submit" class="link">
+ <button type="submit" class="small">
+ <Icon name="logout" />
Sign out
</button>
</form>
diff --git a/src/views/ui.tsx b/src/views/ui.tsx
index e4a8a9f..52de417 100644
--- a/src/views/ui.tsx
+++ b/src/views/ui.tsx
@@ -5,6 +5,7 @@
*/
import type { Child } from "hono/jsx";
+import { ICONS, type IconName } from "./icons";
// Flash messages travel as a fixed code in `?m=`, never as free text, so a
// crafted link can't put words in this site's mouth.
@@ -53,6 +54,24 @@ export function ErrorNote(props: { error?: string | null | undefined }) {
) : null;
}
+/** A pixelarticons glyph. Sizes with the surrounding font (see `.icon` in style.css). */
+export function Icon(props: { name: IconName; class?: string }) {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ class={props.class ? `icon ${props.class}` : "icon"}
+ aria-hidden="true"
+ focusable="false"
+ >
+ {ICONS[props.name].map((d) => (
+ <path d={d} />
+ ))}
+ </svg>
+ );
+}
+
export function Csrf(props: { token: string }) {
return <input type="hidden" name="_csrf" value={props.token} />;
}