Skip to content

Commit 447e2d3

Browse files
Daedalusclaude
andcommitted
feat(ui): refine site design with light/dark theme and scroll-reveal fades
Visual refresh of the FlopCoin site with no changes to any copy — every paragraph, heading, list and link on the home and owners pages is preserved verbatim; only markup, styling and chrome changed. - Theme: Tailwind `darkMode: 'class'`, a no-flash inline script (stored choice then OS-preference fallback) and a ThemeToggle that persists to localStorage. - Tokens: light/dark palette as CSS variables mapped to Tailwind utilities, themed shadows, custom scrollbar/selection, smooth theme cross-fade; body now uses Geist (removed the stray Arial override). - Chrome: shared sticky frosted header (coin logo, Home/Owners nav, toggle) and footer in the root layout; coin mark inverts in dark mode. - Cards: alternating image/text cards with subtle borders/shadows and responsive square photo frames with a gentle hover zoom. - Motion: <Reveal> scroll-in fades (IntersectionObserver) with a reduced-motion opt-out and a <noscript> reveal fallback. - Docs: AGENTS.md gains a "Theming & UI" section and lists src/components. Verified: `yarn lint` clean, `yarn build` static export succeeds, home + owners rendered via headless chromium in light and dark (and mobile). Squash of #1. Co-Authored-By: Daedalus <daedalus@agents.flopbut.local> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7498d94 commit 447e2d3

8 files changed

Lines changed: 521 additions & 131 deletions

File tree

‎AGENTS.md‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ runtime. Owners are maintained by editing a JSON file in the repo.
2929

3030
```
3131
src/app/ App Router
32-
layout.tsx Root layout: <html>, metadata (title/description/icon), Geist fonts
32+
layout.tsx Root layout: <html>, metadata, Geist fonts, no-flash theme
33+
script, shared sticky header (logo/nav/toggle) + footer
3334
page.tsx Home page — what a FlopCoin is, how to use it, examples, limits
3435
owners/page.tsx Owners list (server component; see "Owners" below)
35-
globals.css Global styles / Tailwind layers
36+
globals.css Tailwind layers + theme design tokens (see "Theming & UI")
3637
favicon.ico
38+
src/components/ Shared client components
39+
ThemeToggle.tsx Light/dark toggle (persists to localStorage)
40+
Reveal.tsx Scroll-in fade wrapper (IntersectionObserver)
3741
public/ Static assets served at site root
3842
owners.json Source of truth for the owners list
3943
coin.svg, *.svg Icons / logo
@@ -71,6 +75,26 @@ a static export this happens **at build time**, not per request.
7175
with the file mtime as fallback. That is why CI checks out with `fetch-depth: 0` —
7276
a shallow clone would leave the page showing the build date instead.
7377

78+
## Theming & UI
79+
80+
- **Light/dark theme** is class-based (Tailwind `darkMode: 'class'`). A small inline
81+
script in `layout.tsx` runs before first paint and adds `dark` to `<html>` from the
82+
saved choice in `localStorage['theme']`, falling back to the OS `prefers-color-scheme`
83+
— this prevents any flash of the wrong theme. `ThemeToggle` flips that class and saves
84+
the choice. There is no separate "system" mode: the OS preference is only the default
85+
before the user has toggled.
86+
- **Design tokens** live in `globals.css` as CSS variables on `:root` / `.dark`
87+
(`--bg`, `--surface`, `--line`, `--fg`, `--fg-muted`, `--accent`, shadows). Tailwind
88+
maps them to utilities (`bg-surface`, `text-fg`, `border-line`, `text-accent`, …), so
89+
prefer those over hard-coded `gray-*` classes. Reusable pieces (`.card`, `.link`,
90+
`.site-header`, `.btn-icon`, `.nav-link`, `.photo-frame`) are defined there too.
91+
- **Motion:** wrap a block in `<Reveal>` to fade+slide it in when it scrolls into view.
92+
It degrades safely — `prefers-reduced-motion` disables the animation and a `<noscript>`
93+
rule reveals everything when JS is off. Keep new above-the-fold content inside `Reveal`
94+
only when a brief pre-JS hidden state is acceptable.
95+
- The Geist font is applied via `--font-geist-sans`; do not re-introduce a hard-coded
96+
`font-family` in `globals.css`.
97+
7498
## Deployment
7599

76100
The site is a **static export** hosted on **Cloudflare Pages**, project `flopcoin`

‎src/app/globals.css‎

Lines changed: 171 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,184 @@
22
@tailwind components;
33
@tailwind utilities;
44

5+
/*
6+
* Theme tokens. Light is the default; `.dark` on <html> flips them.
7+
* The no-flash script in layout.tsx sets that class before first paint,
8+
* falling back to the OS `prefers-color-scheme` when no choice is stored.
9+
*/
510
:root {
6-
--background: #ffffff;
7-
--foreground: #171717;
11+
--bg: #f6f5f2;
12+
--bg-elevated: #ffffff;
13+
--surface: #ffffff;
14+
--surface-2: #efece6;
15+
--line: #e4e0d8;
16+
--fg: #1b1b1f;
17+
--fg-muted: #6c6b73;
18+
--accent: #4f46e5;
19+
--accent-hover: #4338ca;
20+
--shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.05), 0 1px 3px rgba(24, 24, 27, 0.04);
21+
--shadow-lg: 0 1px 2px rgba(24, 24, 27, 0.05), 0 18px 40px -20px rgba(24, 24, 27, 0.28);
822
}
923

1024
.dark {
11-
--background: #0a0a0a;
12-
--foreground: #ededed;
25+
--bg: #0b0b0d;
26+
--bg-elevated: #131316;
27+
--surface: #17171b;
28+
--surface-2: #1f1f25;
29+
--line: #2a2a31;
30+
--fg: #ececee;
31+
--fg-muted: #9a9aa5;
32+
--accent: #a5b4fc;
33+
--accent-hover: #c7d2fe;
34+
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
35+
--shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 48px -24px rgba(0, 0, 0, 0.7);
1336
}
1437

15-
@media (prefers-color-scheme: dark) {
16-
:root {
17-
--background: #0a0a0a;
18-
--foreground: #ededed;
38+
@layer base {
39+
html {
40+
scroll-behavior: smooth;
41+
}
42+
43+
body {
44+
background: var(--bg);
45+
color: var(--fg);
46+
font-family: var(--font-geist-sans), ui-sans-serif, system-ui, -apple-system,
47+
"Segoe UI", Roboto, Helvetica, Arial, sans-serif;
48+
/* Smooth theme cross-fade */
49+
transition: background-color 0.4s ease, color 0.4s ease;
50+
}
51+
52+
::selection {
53+
background: color-mix(in srgb, var(--accent) 28%, transparent);
54+
}
55+
56+
/* Quiet, themed scrollbar */
57+
* {
58+
scrollbar-width: thin;
59+
scrollbar-color: var(--line) transparent;
60+
}
61+
::-webkit-scrollbar {
62+
width: 10px;
63+
height: 10px;
64+
}
65+
::-webkit-scrollbar-thumb {
66+
background: var(--line);
67+
border-radius: 9999px;
68+
border: 2px solid var(--bg);
1969
}
2070
}
2171

22-
body {
23-
color: var(--foreground);
24-
background: var(--background);
25-
font-family: Arial, Helvetica, sans-serif;
72+
@layer components {
73+
.link {
74+
color: var(--accent);
75+
text-decoration: underline;
76+
text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
77+
text-underline-offset: 2px;
78+
transition: color 0.2s ease, text-decoration-color 0.2s ease;
79+
}
80+
.link:hover {
81+
color: var(--accent-hover);
82+
text-decoration-color: var(--accent-hover);
83+
}
84+
85+
/* Frosted, sticky top bar */
86+
.site-header {
87+
background: color-mix(in srgb, var(--bg) 78%, transparent);
88+
-webkit-backdrop-filter: saturate(180%) blur(12px);
89+
backdrop-filter: saturate(180%) blur(12px);
90+
border-bottom: 1px solid var(--line);
91+
}
92+
93+
/* Content card */
94+
.card {
95+
background: var(--surface);
96+
border: 1px solid var(--line);
97+
border-radius: 1rem;
98+
box-shadow: var(--shadow-sm);
99+
transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
100+
}
101+
.card:hover {
102+
box-shadow: var(--shadow-lg);
103+
border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
104+
}
105+
106+
/* Square, framed photo with a gentle zoom on hover */
107+
.photo-frame {
108+
position: relative;
109+
overflow: hidden;
110+
border-radius: 0.85rem;
111+
border: 1px solid var(--line);
112+
box-shadow: var(--shadow-sm);
113+
background: var(--surface-2);
114+
}
115+
.photo-frame img {
116+
transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
117+
}
118+
.photo-frame:hover img {
119+
transform: scale(1.045);
120+
}
121+
122+
/* Icon button (theme toggle) */
123+
.btn-icon {
124+
display: inline-flex;
125+
align-items: center;
126+
justify-content: center;
127+
height: 2.25rem;
128+
width: 2.25rem;
129+
border-radius: 0.75rem;
130+
border: 1px solid var(--line);
131+
background: var(--surface);
132+
color: var(--fg);
133+
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
134+
}
135+
.btn-icon:hover {
136+
background: var(--surface-2);
137+
border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
138+
color: var(--accent);
139+
}
140+
141+
/* Header nav pill */
142+
.nav-link {
143+
display: inline-flex;
144+
align-items: center;
145+
padding: 0.4rem 0.75rem;
146+
border-radius: 0.75rem;
147+
font-size: 0.9rem;
148+
font-weight: 500;
149+
color: var(--fg-muted);
150+
transition: background-color 0.2s ease, color 0.2s ease;
151+
}
152+
.nav-link:hover {
153+
color: var(--fg);
154+
background: var(--surface-2);
155+
}
156+
}
157+
158+
/* Scroll-reveal primitive used by <Reveal>. */
159+
.reveal {
160+
opacity: 0;
161+
transform: translateY(18px);
162+
transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
163+
transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
164+
will-change: opacity, transform;
165+
}
166+
.reveal-in {
167+
opacity: 1;
168+
transform: none;
169+
}
170+
171+
@media (prefers-reduced-motion: reduce) {
172+
html {
173+
scroll-behavior: auto;
174+
}
175+
.reveal {
176+
opacity: 1;
177+
transform: none;
178+
transition: none;
179+
}
180+
.photo-frame img,
181+
.card,
182+
body {
183+
transition: none;
184+
}
26185
}

‎src/app/layout.tsx‎

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import type { Metadata } from "next";
1+
import type { Metadata, Viewport } from "next";
22
import { Geist, Geist_Mono } from "next/font/google";
3+
import Image from "next/image";
4+
import Link from "next/link";
35
import "./globals.css";
6+
import ThemeToggle from "@/components/ThemeToggle";
47

58
const geistSans = Geist({
69
variable: "--font-geist-sans",
@@ -20,17 +23,72 @@ export const metadata: Metadata = {
2023
},
2124
};
2225

26+
export const viewport: Viewport = {
27+
themeColor: [
28+
{ media: "(prefers-color-scheme: light)", color: "#f6f5f2" },
29+
{ media: "(prefers-color-scheme: dark)", color: "#0b0b0d" },
30+
],
31+
};
32+
33+
// Runs before first paint: apply the stored theme, or fall back to the OS
34+
// preference, so there is no light/dark flash on load.
35+
const noFlashTheme = `(function(){try{var t=localStorage.getItem('theme');var d=t?t==='dark':window.matchMedia('(prefers-color-scheme: dark)').matches;if(d)document.documentElement.classList.add('dark');}catch(e){}})();`;
36+
2337
export default function RootLayout({
2438
children,
2539
}: Readonly<{
2640
children: React.ReactNode;
2741
}>) {
2842
return (
29-
<html lang="en">
43+
<html lang="en" suppressHydrationWarning>
44+
<head>
45+
<script dangerouslySetInnerHTML={{ __html: noFlashTheme }} />
46+
{/* With JS disabled, scroll-reveal content would stay hidden — show it. */}
47+
<noscript>
48+
<style>{`.reveal{opacity:1 !important;transform:none !important}`}</style>
49+
</noscript>
50+
</head>
3051
<body
31-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
52+
className={`${geistSans.variable} ${geistMono.variable} antialiased flex min-h-screen flex-col`}
3253
>
33-
{children}
54+
<header className="site-header sticky top-0 z-40">
55+
<div className="mx-auto flex h-16 max-w-content items-center justify-between px-5 sm:px-8">
56+
<Link
57+
href="/"
58+
className="group flex items-center gap-2.5 rounded-lg"
59+
aria-label="FlopCoin home"
60+
>
61+
<Image
62+
src="/coin.svg"
63+
alt=""
64+
width={30}
65+
height={30}
66+
className="transition-transform duration-500 group-hover:rotate-[18deg] dark:invert"
67+
priority
68+
/>
69+
<span className="text-base font-semibold tracking-tight">
70+
FlopCoin
71+
</span>
72+
</Link>
73+
<nav className="flex items-center gap-1 sm:gap-2">
74+
<Link href="/" className="nav-link">
75+
Home
76+
</Link>
77+
<Link href="/owners" className="nav-link">
78+
Owners
79+
</Link>
80+
<ThemeToggle />
81+
</nav>
82+
</div>
83+
</header>
84+
85+
<div className="flex-grow">{children}</div>
86+
87+
<footer className="border-t border-line">
88+
<div className="mx-auto max-w-content px-5 py-8 text-center text-sm text-fg-muted sm:px-8">
89+
(c) 2025 FlopCoin.art
90+
</div>
91+
</footer>
3492
</body>
3593
</html>
3694
);

0 commit comments

Comments
 (0)