commit
Fix CSS
diff --git a/public/_app/background.avif b/public/_app/background.avif
new file mode 100644
index 0000000..b286ce8
Binary files /dev/null and b/public/_app/background.avif differ
diff --git a/public/_app/fonts/IBMPlexSans-Bold.woff2 b/public/_app/fonts/IBMPlexSans-Bold.woff2
new file mode 100644
index 0000000..486c376
Binary files /dev/null and b/public/_app/fonts/IBMPlexSans-Bold.woff2 differ
diff --git a/public/_app/fonts/IBMPlexSans-Medium.woff2 b/public/_app/fonts/IBMPlexSans-Medium.woff2
new file mode 100644
index 0000000..ce72c05
Binary files /dev/null and b/public/_app/fonts/IBMPlexSans-Medium.woff2 differ
diff --git a/public/_app/fonts/IBMPlexSans-Regular.woff2 b/public/_app/fonts/IBMPlexSans-Regular.woff2
new file mode 100644
index 0000000..136597e
Binary files /dev/null and b/public/_app/fonts/IBMPlexSans-Regular.woff2 differ
diff --git a/public/_app/fonts/IBMPlexSans-SemiBold.woff2 b/public/_app/fonts/IBMPlexSans-SemiBold.woff2
new file mode 100644
index 0000000..78cbe9a
Binary files /dev/null and b/public/_app/fonts/IBMPlexSans-SemiBold.woff2 differ
diff --git a/public/style.css b/public/style.css
index c20c9fd..94d6db9 100644
--- a/public/style.css
+++ b/public/style.css
@@ -1,250 +1,373 @@
+/* Shared look with doughmination.gay (~/projects/web): IBM Plex Sans, the
+ same tokens, the faded background behind the top of the page, a header
+ bar, and rounded cards. Served as-is, so the worker's own pages
+ (src/views.ts) use it too. */
+
@font-face {
- font-family: "Comic Code";
- src: url("https://fonts.doughmination.co.uk/ComicCode-Regular_2022-05-24-151938_hsmz.woff2") format("woff2");
+ font-family: "IBM Plex Sans";
+ src: url("/_app/fonts/IBMPlexSans-Regular.woff2") format("woff2");
font-weight: 400;
- font-style: normal;
font-display: swap;
}
@font-face {
- font-family: "Comic Code";
- src: url("https://fonts.doughmination.co.uk/ComicCode-Bold_2022-05-24-152309_zqkm.woff2") format("woff2");
+ font-family: "IBM Plex Sans";
+ src: url("/_app/fonts/IBMPlexSans-Medium.woff2") format("woff2");
+ font-weight: 500;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: "IBM Plex Sans";
+ src: url("/_app/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
+ font-weight: 600;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: "IBM Plex Sans";
+ src: url("/_app/fonts/IBMPlexSans-Bold.woff2") format("woff2");
font-weight: 700;
- font-style: normal;
font-display: swap;
}
:root {
- --bg: #0a0b10;
- --bg-deep: #05060a;
- --fg: #f4f6fb;
- --muted: #9aa3c2;
- --accent: #f5a9b8;
- --accent-alt: #d15f8c;
- --panel: #12141c;
- --border: #232838;
+ --bg: #0b0a0d;
+ --raised: rgb(255 255 255 / 3.5%);
+ --line: rgb(255 255 255 / 9%);
+ --text: #ece9ef;
+ --muted: #a49eab;
+ --accent: #eb459e;
+ --accent-dim: rgb(235 69 158 / 14%);
+ --danger: #ed4245;
+ --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
+
+ color-scheme: dark;
+ font-family: "IBM Plex Sans", system-ui, sans-serif;
+ background: var(--bg);
+ color: var(--text);
}
* { box-sizing: border-box; }
-/* Trans-flag stripe, run above the title instead of animating it as gradient
- text — same move as the terminal/clunky redesign across the other sites. */
-.flag-stripe {
- height: 3px;
- width: 72px;
- margin: 0 0 0.9rem;
- background: repeating-linear-gradient(
- 90deg,
- #5BCEFA 0 20%, #F5A9B8 20% 40%, #ffffff 40% 60%, #F5A9B8 60% 80%, #5BCEFA 80% 100%
- );
-}
-
-.trans-title {
- font-weight: 700;
- letter-spacing: -0.01em;
- text-transform: uppercase;
- color: var(--fg);
-}
+html { height: 100%; }
-html, body {
- margin: 0;
+body {
+ display: flex;
+ position: relative;
+ flex-direction: column;
min-height: 100%;
+ margin: 0;
+ font-size: 1rem;
+ line-height: 1.6;
}
-body {
- background: var(--bg);
- color: var(--fg);
- font: 16px/1.6 "Comic Code", ui-monospace, SFMono-Regular, Menlo, monospace;
- display: flex;
- justify-content: center;
- padding: 2rem;
+a {
+ color: var(--text);
+ text-decoration-color: rgb(235 69 158 / 55%);
+ text-underline-offset: 0.2em;
}
-main {
- max-width: 44rem;
- width: 100%;
+a:hover {
+ color: #fff;
+ text-decoration-color: var(--accent);
}
h1 {
margin: 0 0 1rem;
- font-size: 1.8rem;
+ line-height: 1.25;
+ text-wrap: balance;
}
p { margin: 0 0 1rem; }
-.note {
+.wrap {
+ width: 100%;
+ max-width: 62rem;
+ margin: 0 auto;
+ padding-inline: 1.5rem;
+}
+
+/* Backdrop: fixed height, so every page gets the same amount of background */
+
+.backdrop {
+ position: absolute;
+ top: 0;
+ right: 0;
+ left: 0;
+ z-index: -1;
+ height: 30rem;
+ overflow: hidden;
+ pointer-events: none;
+}
+
+.backdrop::before {
+ content: "";
+ position: absolute;
+ inset: 0;
+ background: url("/_app/background.avif") center / cover no-repeat;
+ opacity: 0.5;
+}
+
+.backdrop::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ background:
+ linear-gradient(rgb(11 10 13 / 55%), rgb(11 10 13 / 80%) 55%, var(--bg)),
+ radial-gradient(70% 60% at 20% 30%, rgb(235 69 158 / 12%), transparent 70%);
+}
+
+/* Top bar */
+
+header {
+ position: relative;
+ z-index: 2;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 1rem 1.5rem;
+ align-items: center;
+ justify-content: space-between;
+ width: 100%;
+ max-width: 62rem;
+ margin: 0 auto;
+ padding: 1.25rem 1.5rem;
+}
+
+header nav {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5rem 1.25rem;
+ font-size: 0.9rem;
+}
+
+header nav a {
color: var(--muted);
+ text-decoration: none;
+}
+
+header nav a:hover,
+header nav a[aria-current="page"] { color: var(--text); }
+
+.brand {
+ display: inline-flex;
+ gap: 0.6rem;
+ align-items: center;
+ font-weight: 600;
+ letter-spacing: 0.01em;
+ text-decoration: none;
+}
+
+.brand img {
+ border-radius: 50%;
+ outline: 1px solid var(--line);
+}
+
+/* Page heading */
+
+.hero { padding-block: 3rem 1.5rem; }
+
+.eyebrow {
+ margin: 0 0 0.5rem;
+ color: var(--accent);
+ font-size: 0.75rem;
+ font-weight: 600;
+ letter-spacing: 0.14em;
+ text-transform: uppercase;
+}
+
+.hero h1 {
+ margin: 0 0 0.75rem;
+ font-size: clamp(2.25rem, 7vw, 3.5rem);
+ font-weight: 700;
+ letter-spacing: -0.03em;
+ overflow-wrap: anywhere;
+}
+
+.lede {
+ max-width: 36rem;
+ color: #cfc9d6;
+}
+
+.note {
+ max-width: 36rem;
+ padding-left: 1rem;
border-left: 3px solid var(--accent);
- padding-left: 0.9rem;
+ color: var(--muted);
font-size: 0.95rem;
}
-a { color: var(--accent); }
+.content { padding-bottom: 3rem; }
/* Breadcrumbs */
+
.crumbs {
- margin: 1.5rem 0 0.75rem;
- font-size: 0.95rem;
+ margin: 0 0 1rem;
+ color: var(--muted);
+ font-size: 0.9rem;
+ overflow-wrap: anywhere;
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep {
- color: var(--muted);
margin: 0 0.4rem;
+ color: var(--line);
}
-/* Filter */
+/* Inputs */
+
.filter {
width: 100%;
- background: var(--panel);
- color: var(--fg);
- border: 1px solid var(--border);
- border-radius: 0;
- padding: 0.5rem 0.75rem;
+ margin-bottom: 1rem;
+ padding: 0.6rem 0.9rem;
+ border: 1px solid var(--line);
+ border-radius: 0.75rem;
+ background: var(--raised);
+ color: var(--text);
font: inherit;
font-size: 0.95rem;
- margin-bottom: 1rem;
}
.filter:focus {
outline: none;
border-color: var(--accent);
+ box-shadow: 0 0 0 4px var(--accent-dim);
}
-/* Folder action bar */
-.folderbar {
- margin-bottom: 1rem;
-}
+/* Pill buttons */
-.folderbar:empty {
- margin-bottom: 0;
-}
+.folderbar { margin-bottom: 1rem; }
+.folderbar:empty { margin-bottom: 0; }
.folderbtn,
-.btn {
- display: inline-block;
- background: var(--panel);
- border: 1px solid var(--accent);
- border-radius: 0;
- padding: 0.4rem 0.8rem;
+.btn,
+.row .copy,
+.row .remove {
+ display: inline-flex;
+ gap: 0.4em;
+ align-items: center;
+ padding: 0.35rem 0.9rem;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: var(--raised);
+ color: var(--text);
font: inherit;
font-size: 0.9rem;
text-decoration: none;
- color: var(--fg);
cursor: pointer;
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
+}
+
+.row .copy,
+.row .remove {
+ padding: 0.15rem 0.7rem;
+ color: var(--muted);
+ font-size: 0.8rem;
}
.folderbtn:hover,
-.btn:hover:not(:disabled) {
- background: var(--accent);
- color: #14121a;
+.btn:hover:not(:disabled),
+.row .copy:hover,
+.row .remove:hover {
+ border-color: rgb(235 69 158 / 40%);
+ box-shadow: 0 0 0 4px var(--accent-dim);
+ color: var(--text);
}
.btn:disabled {
- border-color: var(--border);
color: var(--muted);
cursor: default;
}
-/* Listing */
+/* Listing card */
+
.listing {
- list-style: none;
margin: 0;
padding: 0;
- border: 1px solid var(--border);
- border-radius: 0;
overflow: hidden;
+ border: 1px solid var(--line);
+ border-radius: 1rem;
+ background: var(--raised);
+ list-style: none;
}
.row {
display: flex;
- align-items: center;
gap: 0.75rem;
- padding: 0.5rem 0.9rem;
- border-top: 1px solid var(--border);
+ align-items: center;
+ padding: 0.6rem 1.1rem;
+ border-top: 1px solid var(--line);
}
.row:first-child { border-top: none; }
-.row:hover { background: var(--panel); }
+.row:hover { background: var(--accent-dim); }
.row .name {
flex: 1;
min-width: 0;
- text-decoration: none;
- color: var(--fg);
overflow: hidden;
+ color: var(--text);
+ text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
}
-.row.folder .name { color: var(--accent); }
+.row.folder .name { font-weight: 500; }
+.row.folder .name svg { color: var(--accent); }
.row .name:hover { text-decoration: underline; }
-.row .size {
+.row .size,
+.row .status {
color: var(--muted);
font-size: 0.85rem;
white-space: nowrap;
}
-.row .copy {
- background: transparent;
- color: var(--muted);
- border: 1px solid var(--border);
- border-radius: 0;
- padding: 0.15rem 0.55rem;
- font: inherit;
- font-size: 0.8rem;
- cursor: pointer;
-}
-
-.row .copy:hover {
- color: var(--fg);
- border-color: var(--accent);
-}
+.row .status.ok { color: var(--accent); }
+.row .status.err { color: var(--danger); text-align: right; white-space: normal; }
.row.empty {
- color: var(--muted);
justify-content: center;
-}
-
-footer {
- margin-top: 2rem;
color: var(--muted);
- font-size: 0.85rem;
}
/* Upload page */
+
.field {
display: block;
- margin: 1.5rem 0 1rem;
+ margin: 0 0 1rem;
}
.field .label {
display: block;
+ margin-bottom: 0.3rem;
color: var(--muted);
font-size: 0.85rem;
- margin-bottom: 0.3rem;
}
.field .filter { margin-bottom: 0; }
.drop {
display: block;
- border: 1px dashed var(--border);
- padding: 2rem 1rem;
- text-align: center;
+ margin-bottom: 1rem;
+ padding: 2.5rem 1rem;
+ border: 1px dashed var(--line);
+ border-radius: 1rem;
+ background: var(--raised);
color: var(--muted);
+ text-align: center;
cursor: pointer;
- margin-bottom: 1rem;
+ transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.drop:hover,
.drop.over,
.drop:focus-within {
border-color: var(--accent);
- color: var(--fg);
+ box-shadow: 0 0 0 4px var(--accent-dim);
+ color: var(--text);
}
.drop input {
@@ -257,80 +380,83 @@ footer {
.actions {
display: flex;
flex-wrap: wrap;
+ gap: 0.75rem 1rem;
align-items: center;
- gap: 1rem;
margin-bottom: 1rem;
+ color: var(--muted);
font-size: 0.9rem;
}
-.actions label { color: var(--muted); }
.actions input { accent-color: var(--accent); }
-.row .status {
- color: var(--muted);
- font-size: 0.85rem;
- white-space: nowrap;
-}
-
-.row .status.ok { color: var(--accent); }
-.row .status.err { color: #ff6b81; white-space: normal; text-align: right; }
+/* File preview */
-.row .remove {
- background: transparent;
- color: var(--muted);
- border: 1px solid var(--border);
- border-radius: 0;
- padding: 0.15rem 0.55rem;
- font: inherit;
- font-size: 0.8rem;
- cursor: pointer;
+.preview {
+ overflow: hidden;
+ border: 1px solid var(--line);
+ border-radius: 1rem;
+ background: var(--raised);
}
-.row .remove:hover { color: var(--fg); border-color: var(--accent); }
+.preview img,
+.preview video {
+ display: block;
+ max-width: 100%;
+ max-height: 75vh;
+ margin: 0 auto;
+}
-@media (max-width: 520px) {
- body { padding: 1.25rem 1rem; }
- .row { flex-wrap: wrap; }
+.preview audio {
+ display: block;
+ width: 100%;
+ padding: 1rem;
}
-/* Rendered markdown (licence page) */
-.doc {
- line-height: 1.7;
+.preview iframe {
+ display: block;
+ width: 100%;
+ height: 75vh;
+ border: none;
}
-.doc h1 {
- font-size: 1.5rem;
- margin: 1.8rem 0 0.75rem;
+.preview pre {
+ max-height: 75vh;
+ margin: 0;
+ padding: 1rem 1.25rem;
+ overflow: auto;
+ font: 0.85rem/1.55 var(--mono);
+ tab-size: 2;
}
-.doc h2 {
- font-size: 1.2rem;
- margin: 1.5rem 0 0.6rem;
+.preview .empty {
+ margin: 0;
+ padding: 2.5rem 1rem;
+ color: var(--muted);
+ text-align: center;
}
+/* Rendered markdown (licence page) */
+
+.doc { line-height: 1.7; }
+.doc h1 { font-size: 1.5rem; margin: 1.8rem 0 0.75rem; }
+.doc h2 { font-size: 1.2rem; margin: 1.5rem 0 0.6rem; }
.doc h3 { font-size: 1.05rem; }
+.doc ul,
+.doc ol { padding-left: 1.3rem; }
+.doc li { margin: 0.3rem 0; }
.doc hr {
- border: none;
- border-top: 1px solid var(--border);
margin: 1.6rem 0;
+ border: none;
+ border-top: 1px solid var(--line);
}
-.doc ul,
-.doc ol {
- padding-left: 1.3rem;
-}
-
-.doc li { margin: 0.3rem 0; }
-
-.doc a { color: var(--accent); }
-
.doc code {
- background: var(--panel);
- border: 1px solid var(--border);
- border-radius: 0;
padding: 0.1rem 0.35rem;
- font-size: 0.9em;
+ border: 1px solid var(--line);
+ border-radius: 0.35rem;
+ background: var(--raised);
+ font: 0.9em var(--mono);
}
.doc pre {
@@ -338,52 +464,54 @@ footer {
word-break: break-word;
}
-/* File preview */
-.filename {
- font-size: 1.4rem;
- overflow-wrap: anywhere;
-}
+/* Footer: in the page flow, pinned to the bottom of short pages */
-.preview {
- border: 1px solid var(--border);
- background: var(--bg-deep);
+footer {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.25rem 0.75rem;
+ align-items: center;
+ width: 100%;
+ max-width: 62rem;
+ margin: auto auto 0;
+ padding: 1.25rem 1.5rem;
+ border-top: 1px solid var(--line);
+ color: var(--muted);
+ font-size: 0.85rem;
}
-.preview img,
-.preview video {
- display: block;
- max-width: 100%;
- max-height: 75vh;
- margin: 0 auto;
+footer > span {
+ display: inline-flex;
+ gap: 0.4em;
+ align-items: center;
}
-.preview audio {
- display: block;
- width: 100%;
- padding: 1rem;
+/* Dot between items, skipped on the first */
+footer > span + span::before {
+ content: "·";
+ margin-right: 0.75rem;
+ color: var(--line);
}
-.preview iframe {
- display: block;
- width: 100%;
- height: 75vh;
- border: none;
-}
+footer img { border-radius: 50%; }
-.preview pre {
- margin: 0;
- padding: 0.9rem;
- max-height: 75vh;
- overflow: auto;
- font: inherit;
- font-size: 0.85rem;
- line-height: 1.5;
- tab-size: 2;
+@media (max-width: 40rem) {
+ .hero { padding-block: 2rem 1rem; }
+ .row { flex-wrap: wrap; }
+
+ footer {
+ flex-direction: column;
+ justify-content: center;
+ text-align: center;
+ }
+
+ footer > span + span::before { content: none; }
}
-.preview .empty {
- margin: 0;
- padding: 2rem 1rem;
- text-align: center;
- color: var(--muted);
+@media (prefers-reduced-motion: reduce) {
+ .folderbtn,
+ .btn,
+ .row .copy,
+ .row .remove,
+ .drop { transition: none; }
}
diff --git a/src/views.ts b/src/views.ts
index 7f1b6f7..b6eb23b 100644
--- a/src/views.ts
+++ b/src/views.ts
@@ -12,8 +12,9 @@ export function messagePage(c: AppContext, title: string, body: string, status:
`<meta name="viewport" content="width=device-width, initial-scale=1.0">` +
`<title>${escape(title)}</title><meta name="robots" content="noindex">` +
`<link rel="stylesheet" href="/style.css"></head>` +
- `<body><main><div class="flag-stripe"></div><h1 class="trans-title">${escape(title)}</h1>` +
- `${body}</main></body></html>`,
+ `<body><div class="backdrop" aria-hidden="true"></div>` +
+ `<main class="wrap"><section class="hero"><p class="eyebrow">CDN</p><h1>${escape(title)}</h1>` +
+ `<div class="lede">${body}</div></section></main></body></html>`,
status,
);
}
diff --git a/web/index.html b/web/index.html
index cb8d883..5209676 100644
--- a/web/index.html
+++ b/web/index.html
@@ -20,7 +20,7 @@
<link rel="stylesheet" href="/style.css">
</head>
<body>
- <main id="app"></main>
+ <div id="app" style="display: contents"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
diff --git a/web/src/App.svelte b/web/src/App.svelte
index 7755090..c5b26d0 100644
--- a/web/src/App.svelte
+++ b/web/src/App.svelte
@@ -1,5 +1,7 @@
<script lang="ts">
import { fetchList, fetchMe, type Listing } from "./lib/files";
+ import Footer from "./lib/Footer.svelte";
+ import Header from "./lib/Header.svelte";
import { route } from "./lib/router.svelte";
import Browse from "./routes/Browse.svelte";
import Licence from "./routes/Licence.svelte";
@@ -34,14 +36,18 @@
);
</script>
-{#if route.path === "/upload"}
- <Upload />
-{:else if route.path === "/licence"}
- <Licence />
-{:else if path === null}
- <NotFound />
-{:else if file && listing}
- <Preview {file} raw={listing.raw} />
-{:else}
- <Browse prefix={path} {listing} {failed} {canUpload} />
-{/if}
+<Header />
+<main class="wrap">
+ {#if route.path === "/upload"}
+ <Upload />
+ {:else if route.path === "/licence"}
+ <Licence />
+ {:else if path === null}
+ <NotFound />
+ {:else if file && listing}
+ <Preview {file} raw={listing.raw} />
+ {:else}
+ <Browse prefix={path} {listing} {failed} {canUpload} />
+ {/if}
+</main>
+<Footer count={listing?.count} />
diff --git a/web/src/lib/Footer.svelte b/web/src/lib/Footer.svelte
new file mode 100644
index 0000000..323a69e
--- /dev/null
+++ b/web/src/lib/Footer.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ import { AVATAR, SITE_NAME } from "./site";
+
+ let { count }: { count?: number } = $props();
+</script>
+
+<footer>
+ <span><img src={AVATAR} alt="" width="20" height="20" />{SITE_NAME}</span>
+ {#if count !== undefined}<span>{count} files</span>{/if}
+ <span>assets may move without notice</span>
+ <span>Clove Twilight © {new Date().getFullYear()}</span>
+</footer>
diff --git a/web/src/lib/Header.svelte b/web/src/lib/Header.svelte
new file mode 100644
index 0000000..354d91a
--- /dev/null
+++ b/web/src/lib/Header.svelte
@@ -0,0 +1,23 @@
+<script lang="ts">
+ import { link, route } from "./router.svelte";
+ import { AVATAR, SITE_NAME } from "./site";
+
+ const current = (path: string) => (route.path === path ? "page" : undefined);
+</script>
+
+<!-- Fixed-height page backdrop, so every page gets the same amount of background -->
+<div class="backdrop" aria-hidden="true"></div>
+
+<header>
+ <a class="brand" href="/" use:link>
+ <img src={AVATAR} alt="" width="32" height="32" />
+ <span>{SITE_NAME}</span>
+ </a>
+ <nav>
+ <a href="/" use:link aria-current={current("/")}>Files</a>
+ <!-- Not use:link: the worker sends signed-out visitors to sign in first. -->
+ <a href="/upload" aria-current={current("/upload")}>Upload</a>
+ <a href="/licence" use:link aria-current={current("/licence")}>Licence</a>
+ <a href="https://doughmination.gay">doughmination.gay</a>
+ </nav>
+</header>
diff --git a/web/src/lib/Hero.svelte b/web/src/lib/Hero.svelte
new file mode 100644
index 0000000..eae0606
--- /dev/null
+++ b/web/src/lib/Hero.svelte
@@ -0,0 +1,12 @@
+<script lang="ts">
+ import type { Snippet } from "svelte";
+
+ // The page heading: small accent label, big title, optional text under it.
+ let { eyebrow, title, children }: { eyebrow: string; title: string; children?: Snippet } = $props();
+</script>
+
+<section class="hero">
+ <p class="eyebrow">{eyebrow}</p>
+ <h1>{title}</h1>
+ {@render children?.()}
+</section>
diff --git a/web/src/lib/site.ts b/web/src/lib/site.ts
new file mode 100644
index 0000000..b8ca593
--- /dev/null
+++ b/web/src/lib/site.ts
@@ -0,0 +1,4 @@
+// Site-wide constants.
+
+export const SITE_NAME = "m.doughmination.gay";
+export const AVATAR = "https://raw.doughmination.gay/img/avatars/favicon.png";
diff --git a/web/src/routes/Browse.svelte b/web/src/routes/Browse.svelte
index 21da642..9092d04 100644
--- a/web/src/routes/Browse.svelte
+++ b/web/src/routes/Browse.svelte
@@ -3,6 +3,7 @@
// is the folder: /f/Comic-Code shows everything under "f/Comic-Code/".
import Crumbs from "../lib/Crumbs.svelte";
+ import Hero from "../lib/Hero.svelte";
import Icon from "../lib/Icon.svelte";
import { copyText, encodePath, fmtSize, type Listing } from "../lib/files";
import { link } from "../lib/router.svelte";
@@ -55,52 +56,51 @@
{#if missing}
<NotFound />
{:else}
- <div class="flag-stripe"></div>
- <h1 class="trans-title">Hey, this is my CDN.</h1>
- <p>Assets for my other sites. Meant for me, but you're welcome to look around.</p>
- <p class="note">
- Please don't hotlink. I can change these URLs at any point without
- warning, so anything pointing here may break.
- </p>
+ {#if prefix}
+ <Hero eyebrow="Folder" title={prefix.slice(prefix.lastIndexOf("/") + 1)} />
+ {:else}
+ <Hero eyebrow="Clove's CDN" title="Hey, this is my CDN.">
+ <p class="lede">Assets for my other sites. Meant for me, but you're welcome to look around.</p>
+ <p class="note">
+ Please don't hotlink. I can change these URLs at any point without
+ warning, so anything pointing here may break.
+ </p>
+ </Hero>
+ {/if}
- <Crumbs path={prefix} />
+ <div class="content">
+ <Crumbs path={prefix} />
- <!-- Uploaders get a shortcut to the upload page, aimed at this folder. -->
- <div class="folderbar">
- {#if canUpload}
- <a class="folderbtn" href="/upload?folder={encodeURIComponent(prefix)}"><Icon name="upload" />Upload here</a>
- {/if}
- </div>
+ <!-- Uploaders get a shortcut to the upload page, aimed at this folder. -->
+ <div class="folderbar">
+ {#if canUpload}
+ <a class="folderbtn" href="/upload?folder={encodeURIComponent(prefix)}"><Icon name="upload" />Upload here</a>
+ {/if}
+ </div>
- <input class="filter" type="search" placeholder="Filter this folder…" autocomplete="off" bind:value={filter} />
+ <input class="filter" type="search" placeholder="Filter this folder…" autocomplete="off" bind:value={filter} />
- <ul class="listing">
- {#if failed}
- <li class="row empty">Couldn't load the file list.</li>
- {:else if listing}
- {#each folders as name (name)}
- <li class="row folder">
- <a class="name" href={childHref(name)} use:link><Icon name="folder" />{name}/</a>
- </li>
- {/each}
- {#each files as f (f.path)}
- <li class="row file">
- <a class="name" href={childHref(f.name)} use:link><Icon name="file" />{f.name}</a>
- <span class="size">{fmtSize(f.size)}</span>
- <button class="copy" title="Copy URL" onclick={(e) => copyText(e.currentTarget, fileUrl(f.path))}>copy</button>
- </li>
+ <ul class="listing">
+ {#if failed}
+ <li class="row empty">Couldn't load the file list.</li>
+ {:else if !listing}
+ <li class="row empty">Loading…</li>
{:else}
- {#if !folders.length}<li class="row empty">Nothing here.</li>{/if}
- {/each}
- {/if}
- </ul>
-
- <footer>
- <span>
- {#if failed}{:else if listing}{listing.count} files · © {new Date().getFullYear()} · assets may move without notice ·
- {:else}loading… ·{/if}
- </span>
- <a href="/licence" use:link>Licence</a> ·
- <a href="/upload">Upload</a>
- </footer>
+ {#each folders as name (name)}
+ <li class="row folder">
+ <a class="name" href={childHref(name)} use:link><Icon name="folder" />{name}/</a>
+ </li>
+ {/each}
+ {#each files as f (f.path)}
+ <li class="row file">
+ <a class="name" href={childHref(f.name)} use:link><Icon name="file" />{f.name}</a>
+ <span class="size">{fmtSize(f.size)}</span>
+ <button class="copy" title="Copy URL" onclick={(e) => copyText(e.currentTarget, fileUrl(f.path))}>copy</button>
+ </li>
+ {:else}
+ {#if !folders.length}<li class="row empty">Nothing here.</li>{/if}
+ {/each}
+ {/if}
+ </ul>
+ </div>
{/if}
diff --git a/web/src/routes/Licence.svelte b/web/src/routes/Licence.svelte
index bd2cdbb..7089dd4 100644
--- a/web/src/routes/Licence.svelte
+++ b/web/src/routes/Licence.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
import { marked } from "marked";
- import { link } from "../lib/router.svelte";
+ import Hero from "../lib/Hero.svelte";
const doc = fetch("/LICENCE.md", { cache: "no-cache" }).then((r) => {
if (!r.ok) throw new Error(String(r.status));
@@ -10,8 +10,8 @@
<svelte:head><title>Licence</title></svelte:head>
-<p><a href="/" use:link>← back</a></p>
-<article class="doc">
+<Hero eyebrow="Legal" title="Licence" />
+<article class="doc content">
{#await doc}
Loading licence…
{:then md}
diff --git a/web/src/routes/NotFound.svelte b/web/src/routes/NotFound.svelte
index 5c9e66e..df64801 100644
--- a/web/src/routes/NotFound.svelte
+++ b/web/src/routes/NotFound.svelte
@@ -1,9 +1,13 @@
<script lang="ts">
+ import Hero from "../lib/Hero.svelte";
import { link } from "../lib/router.svelte";
</script>
<svelte:head><title>404 — Not Found</title></svelte:head>
-<h1>404</h1>
-<p>That asset isn't here. It may have moved — URLs here can change at any point.</p>
-<p><a href="/" use:link>Back home</a></p>
+<Hero eyebrow="Error 404" title="Not found">
+ <p class="lede">
+ That asset isn't here. It may have moved — URLs here can change at any point.
+ </p>
+ <p><a href="/" use:link>Go back home</a></p>
+</Hero>
diff --git a/web/src/routes/Preview.svelte b/web/src/routes/Preview.svelte
index 13d020c..10210e6 100644
--- a/web/src/routes/Preview.svelte
+++ b/web/src/routes/Preview.svelte
@@ -4,6 +4,7 @@
// /api/files so the bucket doesn't need CORS for this site.
import Crumbs from "../lib/Crumbs.svelte";
+ import Hero from "../lib/Hero.svelte";
import { copyText, encodePath, fmtSize, type FileEntry } from "../lib/files";
import { extensionOf, kindOf } from "../../../shared/kinds";
@@ -30,38 +31,41 @@
<svelte:head><title>{name} · CDN</title></svelte:head>
-<div class="flag-stripe"></div>
-<Crumbs path={file.path} file />
-<h1 class="filename">{name}</h1>
-<p class="note">{fmtSize(file.size)}{ext ? ` · .${ext}` : ""}</p>
+<Hero eyebrow={kind ?? "File"} title={name}>
+ <p class="lede">{fmtSize(file.size)}{ext ? ` · .${ext}` : ""}</p>
+</Hero>
-<div class="actions">
- <a class="btn" href={url} target="_blank" rel="noopener">Open raw</a>
- <a class="btn" href={local} download={name}>Download</a>
- <button class="btn" type="button" onclick={(e) => copyText(e.currentTarget, url)}>Copy URL</button>
-</div>
+<div class="content">
+ <Crumbs path={file.path} file />
+
+ <div class="actions">
+ <a class="btn" href={url} target="_blank" rel="noopener">Open raw</a>
+ <a class="btn" href={local} download={name}>Download</a>
+ <button class="btn" type="button" onclick={(e) => copyText(e.currentTarget, url)}>Copy URL</button>
+ </div>
-<div class="preview">
- {#if kind === "image"}
- <img src={url} alt={name} />
- {:else if kind === "video"}
- <!-- svelte-ignore a11y_media_has_caption -->
- <video src={url} controls preload="metadata"></video>
- {:else if kind === "audio"}
- <audio src={url} controls preload="metadata"></audio>
- {:else if kind === "pdf"}
- <iframe src={url} title={name}></iframe>
- {:else if text}
- {#await text}
- <p class="empty">Loading…</p>
- {:then body}
- <pre>{body}</pre>
- {:catch}
- <p class="empty">Couldn't load this file.</p>
- {/await}
- {:else if kind === "text"}
- <p class="empty">Too big to preview here. Open the raw file instead.</p>
- {:else}
- <p class="empty">No preview for this kind of file.</p>
- {/if}
+ <div class="preview">
+ {#if kind === "image"}
+ <img src={url} alt={name} />
+ {:else if kind === "video"}
+ <!-- svelte-ignore a11y_media_has_caption -->
+ <video src={url} controls preload="metadata"></video>
+ {:else if kind === "audio"}
+ <audio src={url} controls preload="metadata"></audio>
+ {:else if kind === "pdf"}
+ <iframe src={url} title={name}></iframe>
+ {:else if text}
+ {#await text}
+ <p class="empty">Loading…</p>
+ {:then body}
+ <pre>{body}</pre>
+ {:catch}
+ <p class="empty">Couldn't load this file.</p>
+ {/await}
+ {:else if kind === "text"}
+ <p class="empty">Too big to preview here. Open the raw file instead.</p>
+ {:else}
+ <p class="empty">No preview for this kind of file.</p>
+ {/if}
+ </div>
</div>
diff --git a/web/src/routes/Upload.svelte b/web/src/routes/Upload.svelte
index 56a85c8..ff7a6c1 100644
--- a/web/src/routes/Upload.svelte
+++ b/web/src/routes/Upload.svelte
@@ -2,6 +2,7 @@
// Upload page. Files go one at a time as raw PUTs to /api/files/<path>; the
// worker checks the SSO session and writes them into the R2 bucket.
+ import Hero from "../lib/Hero.svelte";
import { allFolders, copyText, encodePath, fetchList, fetchMe, fmtSize } from "../lib/files";
interface Item {
@@ -94,74 +95,74 @@
<svelte:head><title>Upload</title></svelte:head>
-<div class="flag-stripe"></div>
-<h1 class="trans-title">Upload</h1>
-<p class="note">
- Signed in as <strong>{who}</strong> · <a href="/logout">Sign out</a> · <a href="/{encodePath(folder)}">Browse files</a>
-</p>
-
-<label class="field">
- <span class="label">Folder (blank for the top level)</span>
- <input class="filter" type="text" list="folders" placeholder="img/avatars" autocomplete="off" spellcheck="false" bind:value={folderInput} />
- <datalist id="folders">
- {#each suggestions as d (d)}<option value={d}></option>{/each}
- </datalist>
-</label>
-
-<label
- class="drop"
- class:over
- ondragenter={dragOver}
- ondragover={dragOver}
- ondragleave={() => (over = false)}
- ondrop={(e) => {
- e.preventDefault();
- over = false;
- add(e.dataTransfer?.files);
- }}
->
- <input
- type="file"
- multiple
- onchange={(e) => {
- add(e.currentTarget.files);
- e.currentTarget.value = "";
+<Hero eyebrow="Signed in as {who}" title="Upload">
+ <p class="lede"><a href="/{encodePath(folder)}">Browse this folder</a> · <a href="/logout">Sign out</a></p>
+</Hero>
+
+<div class="content">
+ <label class="field">
+ <span class="label">Folder (blank for the top level)</span>
+ <input class="filter" type="text" list="folders" placeholder="img/avatars" autocomplete="off" spellcheck="false" bind:value={folderInput} />
+ <datalist id="folders">
+ {#each suggestions as d (d)}<option value={d}></option>{/each}
+ </datalist>
+ </label>
+
+ <label
+ class="drop"
+ class:over
+ ondragenter={dragOver}
+ ondragover={dragOver}
+ ondragleave={() => (over = false)}
+ ondrop={(e) => {
+ e.preventDefault();
+ over = false;
+ add(e.dataTransfer?.files);
}}
- />
- Drop files here, or click to pick them.
-</label>
-
-<div class="actions">
- <button class="btn" type="button" disabled={busy || pending === 0} onclick={uploadAll}>
- {pending > 1 ? `Upload ${pending} files` : "Upload"}
- </button>
- <label><input type="checkbox" bind:checked={overwrite} /> Replace files that already exist</label>
- <span>{done ? `${done} uploaded` : ""}</span>
+ >
+ <input
+ type="file"
+ multiple
+ onchange={(e) => {
+ add(e.currentTarget.files);
+ e.currentTarget.value = "";
+ }}
+ />
+ Drop files here, or click to pick them.
+ </label>
+
+ <div class="actions">
+ <button class="btn" type="button" disabled={busy || pending === 0} onclick={uploadAll}>
+ {pending > 1 ? `Upload ${pending} files` : "Upload"}
+ </button>
+ <label><input type="checkbox" bind:checked={overwrite} /> Replace files that already exist</label>
+ <span>{done ? `${done} uploaded` : ""}</span>
+ </div>
+
+ <ul class="listing">
+ {#each queue as item, i (item)}
+ <li class="row file">
+ {#if item.status === "done"}
+ <a class="name" href={item.url} target="_blank" rel="noopener">{item.file.name}</a>
+ {:else}
+ <span class="name">{item.file.name}</span>
+ {/if}
+ <span class="size">{fmtSize(item.file.size)}</span>
+ {#if item.status === "uploading"}
+ <span class="status">{item.progress}%</span>
+ {:else if item.status === "done"}
+ <span class="status ok">done</span>
+ <button class="copy" title="Copy URL" onclick={(e) => copyText(e.currentTarget, item.url)}>copy</button>
+ {:else if item.status === "error"}
+ <span class="status err">{item.message}</span>
+ {:else if busy}
+ <span class="status">waiting</span>
+ {:else}
+ <button class="remove" onclick={() => queue.splice(i, 1)}>remove</button>
+ {/if}
+ </li>
+ {:else}
+ <li class="row empty">No files picked yet.</li>
+ {/each}
+ </ul>
</div>
-
-<ul class="listing">
- {#each queue as item, i (item)}
- <li class="row file">
- {#if item.status === "done"}
- <a class="name" href={item.url} target="_blank" rel="noopener">{item.file.name}</a>
- {:else}
- <span class="name">{item.file.name}</span>
- {/if}
- <span class="size">{fmtSize(item.file.size)}</span>
- {#if item.status === "uploading"}
- <span class="status">{item.progress}%</span>
- {:else if item.status === "done"}
- <span class="status ok">done</span>
- <button class="copy" title="Copy URL" onclick={(e) => copyText(e.currentTarget, item.url)}>copy</button>
- {:else if item.status === "error"}
- <span class="status err">{item.message}</span>
- {:else if busy}
- <span class="status">waiting</span>
- {:else}
- <button class="remove" onclick={() => queue.splice(i, 1)}>remove</button>
- {/if}
- </li>
- {:else}
- <li class="row empty">No files picked yet.</li>
- {/each}
-</ul>