Timeline years as leaves, green now and turning autumn going back; notices instead of dashed boxes
A year's leaf eases from green to gold to autumn between this year and 2000 (leafColor in color.ts); every year before 2000 is fully turned. Empty-section and form notes use one notice style, a flat tinted panel with a solid left bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
592e07f614
commit
d5428297a4
12 changed files with 99 additions and 66 deletions
|
|
@ -12,7 +12,7 @@ const CONTACT = 'info@nextgenerationofunity.org'
|
|||
export default function ComingSoon({ what }: { what: string }) {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<p className="max-w-xl border border-dashed border-brand/30 bg-surface/60 p-6 text-body">
|
||||
<p className="notice max-w-xl p-6 text-body">
|
||||
We’re putting {what} together. In the meantime, ask us at{' '}
|
||||
<a href={`mailto:${CONTACT}`} className="font-semibold text-link underline underline-offset-2">
|
||||
{CONTACT}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => setShowMap(true)}
|
||||
className="flex aspect-video w-full flex-col items-center justify-center gap-1 border border-dashed text-sm"
|
||||
className="flex aspect-video w-full flex-col items-center justify-center gap-1 bg-tint-soft text-sm"
|
||||
style={{ borderColor: `${withAlpha(accent, 33)}`, color: BODY }}
|
||||
>
|
||||
<span className="font-semibold">Show map</span>
|
||||
|
|
|
|||
|
|
@ -710,7 +710,7 @@ export function Repeater({
|
|||
))}
|
||||
|
||||
{spec.preview && PREVIEWS[spec.preview] && (
|
||||
<div className="mt-4 border border-dashed border-brand/30 bg-surface p-4">
|
||||
<div className="notice mt-4 p-4">
|
||||
<p className="mb-3 text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||
Preview
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* reasoning that keeps the map grid config in code. A table for four
|
||||
* rows that nobody edits is a migration and an admin page for nothing.
|
||||
*
|
||||
* `preProgram` is what draws the gap: a dashed rail, hollow year dots,
|
||||
* `preProgram` is what draws the gap: a fainter rail
|
||||
* and the "before the program" marker. It lives on the decade rather
|
||||
* than being a hardcoded year check, so the gap moves if the founding
|
||||
* date is ever revised.
|
||||
|
|
|
|||
|
|
@ -208,6 +208,15 @@ iframe[src*="churchcenter"] {
|
|||
}
|
||||
}
|
||||
|
||||
/* A notice where content would be (an empty section, a form's
|
||||
note, "coming soon"): a flat tinted panel with a solid bar down
|
||||
its left edge. It replaces the dashed outlines these used to have.
|
||||
Padding stays with each use. */
|
||||
@utility notice {
|
||||
background: var(--color-tint-soft);
|
||||
border-left: 4px solid var(--color-brand);
|
||||
}
|
||||
|
||||
/* Buttons, and links drawn as buttons: Poppins Bold, superellipse
|
||||
corners. Color, size and border stay with each button. */
|
||||
@utility btn {
|
||||
|
|
|
|||
|
|
@ -88,3 +88,25 @@ export function paletteFill(name: string): { background: string; color: string }
|
|||
for (const char of name.trim().toLowerCase()) hash = (hash * 31 + char.charCodeAt(0)) >>> 0
|
||||
return NAMED_FILLS[hash % NAMED_FILLS.length]
|
||||
}
|
||||
|
||||
/* ── Timeline leaves ─────────────────────────────────────────────
|
||||
Each year on a timeline is a leaf, green for this year and
|
||||
turning autumn as the years go back: gold, then orange, reaching
|
||||
full autumn at 2000; every year before 2000 is fully turned. The
|
||||
green is the palette's, deepened so a leaf stands out on the
|
||||
page; the autumn shades are the one set of colors outside the
|
||||
palette, since the palette has none. */
|
||||
const LEAF_GREEN = 'color-mix(in oklch, #00b83d 60%, #00521b)'
|
||||
const LEAF_GOLD = '#c98a0b'
|
||||
const LEAF_AUTUMN = '#b8461b'
|
||||
const LEAF_TURNED_BY = 2000
|
||||
|
||||
export function leafColor(year: number, thisYear = new Date().getFullYear()): string {
|
||||
if (year < LEAF_TURNED_BY) return LEAF_AUTUMN
|
||||
const span = Math.max(1, thisYear - LEAF_TURNED_BY)
|
||||
const turned = Math.min(1, Math.max(0, (thisYear - year) / span))
|
||||
// Green to gold over the first half of the span, gold to autumn over the second.
|
||||
return turned <= 0.5
|
||||
? `color-mix(in oklch, ${LEAF_GOLD} ${Math.round(turned * 200)}%, ${LEAF_GREEN})`
|
||||
: `color-mix(in oklch, ${LEAF_AUTUMN} ${Math.round((turned - 0.5) * 200)}%, ${LEAF_GOLD})`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
</div>
|
||||
|
||||
{/* Optional contact details */}
|
||||
<div className="mt-8 border border-dashed border-muted/30 bg-tint/60 p-5 sm:p-6">
|
||||
<div className="notice mt-8 p-5 sm:p-6">
|
||||
<div className="flex flex-wrap items-center">
|
||||
<h3 className="text-base font-bold text-body">
|
||||
{request ? "How we reach you" : "Your details"}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ export default function RequestForm() {
|
|||
</>
|
||||
)}
|
||||
|
||||
<div className="mt-8 border border-dashed border-muted/30 bg-tint/60 p-5 sm:p-6">
|
||||
<div className="notice mt-8 p-5 sm:p-6">
|
||||
<h3 className="text-base font-bold text-body">How we reach you</h3>
|
||||
<p className="mt-1 max-w-prose text-sm" style={{ color: MUTED }}>
|
||||
We use these only to follow up on this request, and we won't add you to any list.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { CaretDown, CaretUp } from '@phosphor-icons/react'
|
||||
import { CaretDown, CaretUp, Leaf } from '@phosphor-icons/react'
|
||||
import { useState } from 'react'
|
||||
import type { GroupedYear, SortDirection } from '../../../lib/timeline.ts'
|
||||
import TimelineYear from './TimelineYear.tsx'
|
||||
|
|
@ -42,7 +42,9 @@ export default function TimelineUpcoming({
|
|||
aria-expanded={open}
|
||||
onClick={() => setOpen((v) => !v)}
|
||||
>
|
||||
<span className="site-tl__upcomingDot" aria-hidden="true" />
|
||||
<span className="site-tl__upcomingLeaf" aria-hidden="true">
|
||||
<Leaf weight="bold" />
|
||||
</span>
|
||||
<span className="site-tl__upcomingLabel">
|
||||
{open
|
||||
? 'Hide what’s scheduled'
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
import { Leaf } from '@phosphor-icons/react'
|
||||
import type { CSSProperties } from 'react'
|
||||
import type { GroupedYear } from '../../../lib/timeline.ts'
|
||||
import { leafColor } from '../../../lib/color.ts'
|
||||
import TimelineEntry from './TimelineEntry.tsx'
|
||||
|
||||
/** Dot diameter scales with volume, so the rail reads as a density chart. */
|
||||
function dotSize(count: number): string {
|
||||
return `${(7 + Math.min(count, 14) * 0.55).toFixed(2)}px`
|
||||
/** Each year is a leaf on the rail, its color turning from green to
|
||||
* autumn as the years go back (leafColor), its size growing with
|
||||
* the year's entries so the rail still reads as a density chart.
|
||||
* Filled, not the icon set's usual bold outline, so the color
|
||||
* carries. */
|
||||
function leafSize(count: number): string {
|
||||
return `${(14 + Math.min(count, 14) * 0.9).toFixed(2)}px`
|
||||
}
|
||||
|
||||
type Props = {
|
||||
|
|
@ -36,10 +42,12 @@ export default function TimelineYear({ year, open, onToggle }: Props) {
|
|||
onClick={() => onToggle(year.year)}
|
||||
>
|
||||
<span
|
||||
className="site-tl__dot"
|
||||
style={{ '--tl-dot': dotSize(year.count) } as CSSProperties}
|
||||
className="site-tl__leaf"
|
||||
style={{ '--tl-leaf': leafSize(year.count), color: leafColor(year.year) } as CSSProperties}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
>
|
||||
<Leaf weight="fill" />
|
||||
</span>
|
||||
<span className="site-tl__yearLabel">{year.year}</span>
|
||||
<span className="site-tl__yearCount">
|
||||
{empty ? '-' : `${year.count} ${year.count === 1 ? 'entry' : 'entries'}`}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@
|
|||
|
||||
.site-tl__decade--pre::before {
|
||||
background: none;
|
||||
border-left: var(--tl-rail-w) dashed var(--tl-rail);
|
||||
opacity: 0.7;
|
||||
border-left: var(--tl-rail-w) solid var(--tl-rail);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
/* Last decade fades out rather than stopping dead. */
|
||||
|
|
@ -132,7 +132,8 @@
|
|||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
border: 1px dashed var(--tl-rail);
|
||||
background: var(--color-tint-soft);
|
||||
border-left: 3px solid var(--tl-rail);
|
||||
font-size: 0.8125rem;
|
||||
color: var(--tl-faint);
|
||||
}
|
||||
|
|
@ -168,45 +169,38 @@
|
|||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Dot sits on the rail; --tl-dot is set inline from the year's item count, so
|
||||
scrolling the page gives you the organization's density at a glance. */
|
||||
.site-tl__dot {
|
||||
/* Each year's leaf sits on the rail (TimelineYear.tsx): its color
|
||||
is the year's, set inline, and --tl-leaf, its size, grows with the
|
||||
year's entries. Tilted either way in turn, like leaves on a stem. */
|
||||
.site-tl__leaf {
|
||||
position: relative;
|
||||
justify-self: start;
|
||||
margin-left: calc(var(--tl-rail-x) - (var(--tl-dot, 8px) / 2) + (var(--tl-rail-w) / 2));
|
||||
width: var(--tl-dot, 8px);
|
||||
height: var(--tl-dot, 8px);
|
||||
border-radius: 50%;
|
||||
background: var(--tl-rail);
|
||||
box-shadow: 0 0 0 4px var(--tl-surface);
|
||||
transition: background-color 140ms ease, transform 140ms ease;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
margin-left: calc(var(--tl-rail-x) - (var(--tl-leaf, 16px) / 2) + (var(--tl-rail-w) / 2));
|
||||
width: var(--tl-leaf, 16px);
|
||||
height: var(--tl-leaf, 16px);
|
||||
font-size: var(--tl-leaf, 16px);
|
||||
transform: rotate(-24deg);
|
||||
transition: transform 140ms ease;
|
||||
}
|
||||
|
||||
.site-tl__yearBtn:hover .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
.site-tl__year:nth-child(even) .site-tl__leaf {
|
||||
transform: rotate(24deg) scaleX(-1);
|
||||
}
|
||||
|
||||
.site-tl__year--featured .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
.site-tl__yearBtn:hover .site-tl__leaf,
|
||||
.site-tl__year--open .site-tl__leaf {
|
||||
transform: rotate(-24deg) scale(1.2);
|
||||
}
|
||||
|
||||
.site-tl__year--featured .site-tl__dot::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -5px;
|
||||
border: 1.5px solid var(--tl-accent);
|
||||
border-radius: 50%;
|
||||
opacity: 0.45;
|
||||
.site-tl__year:nth-child(even) .site-tl__yearBtn:hover .site-tl__leaf,
|
||||
.site-tl__year--open:nth-child(even) .site-tl__leaf {
|
||||
transform: rotate(24deg) scaleX(-1) scale(1.2);
|
||||
}
|
||||
|
||||
.site-tl__year--open .site-tl__dot {
|
||||
background: var(--tl-accent);
|
||||
transform: scale(1.15);
|
||||
}
|
||||
|
||||
.site-tl__decade--pre .site-tl__dot {
|
||||
background: var(--tl-surface);
|
||||
border: 1.5px solid var(--tl-rail);
|
||||
.site-tl__year--featured .site-tl__leaf {
|
||||
font-size: calc(var(--tl-leaf, 16px) * 1.3);
|
||||
}
|
||||
|
||||
.site-tl__yearLabel {
|
||||
|
|
@ -483,7 +477,8 @@ a.site-tl__entry--featured:hover {
|
|||
top: 1.25rem;
|
||||
bottom: 0;
|
||||
left: var(--tl-rail-x);
|
||||
border-left: var(--tl-rail-w) dashed var(--tl-rail);
|
||||
border-left: var(--tl-rail-w) solid var(--tl-rail);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.site-tl__upcomingBtn {
|
||||
|
|
@ -511,14 +506,13 @@ a.site-tl__entry--featured:hover {
|
|||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.site-tl__upcomingDot {
|
||||
.site-tl__upcomingLeaf {
|
||||
justify-self: start;
|
||||
margin-left: calc(var(--tl-rail-x) - 4px + (var(--tl-rail-w) / 2));
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
border: 1.5px dashed var(--tl-accent);
|
||||
box-shadow: 0 0 0 4px var(--tl-surface);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
margin-left: calc(var(--tl-rail-x) - 7px + (var(--tl-rail-w) / 2));
|
||||
font-size: 14px;
|
||||
color: color-mix(in oklch, #00b83d 60%, #00521b);
|
||||
}
|
||||
|
||||
.site-tl__upcomingLabel {
|
||||
|
|
@ -541,11 +535,6 @@ a.site-tl__entry--featured:hover {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
.site-tl__upcomingList .site-tl__dot {
|
||||
background: var(--tl-surface);
|
||||
border: 1.5px dashed var(--tl-accent);
|
||||
}
|
||||
|
||||
@keyframes site-tl-rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
Nothing featured, and the section doesn't render at all.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { ArrowRight, CaretRight, CaretLeft } from '@phosphor-icons/react';
|
||||
import { ArrowRight, CaretRight, CaretLeft, Leaf } from '@phosphor-icons/react';
|
||||
import { useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ import HomeLink from './HomeLink.tsx'
|
|||
import { useHistory } from '../../../lib/useHistory.ts'
|
||||
import { hrefFor, logoSrc } from '../../../lib/timelineRefs.ts'
|
||||
import { MONTH_LABELS, type TimelineItem } from '../../../lib/timeline.ts'
|
||||
import { accentText, BRAND } from '../../../lib/color.ts'
|
||||
import { accentText, BRAND, leafColor } from '../../../lib/color.ts'
|
||||
import { scrollBehavior } from '../../../lib/motion.ts';
|
||||
|
||||
const DRAG_SLOP = 6
|
||||
|
|
@ -220,16 +220,19 @@ function RailCard({ item, showYear }: { item: TimelineItem; showYear: boolean })
|
|||
|
||||
return (
|
||||
<div className="flex h-full flex-col">
|
||||
{/* The line, its dot, and the year where it changes. */}
|
||||
{/* The line, its leaf (colored by the year, as on the History
|
||||
page), and the year where it changes. */}
|
||||
<div className="relative mb-4 h-8">
|
||||
<div className="absolute inset-x-[-1.5rem] top-1/2 h-px bg-brand/30" />
|
||||
<span
|
||||
className="absolute left-0 top-1/2 h-3 w-3 -translate-y-1/2 rounded-full border-2 bg-surface"
|
||||
style={{ borderColor: BRAND }}
|
||||
<Leaf
|
||||
weight="fill"
|
||||
aria-hidden="true"
|
||||
className="absolute -left-1 top-1/2 h-5 w-5 -translate-y-1/2 -rotate-12"
|
||||
style={{ color: leafColor(Number(year(item))) }}
|
||||
/>
|
||||
{showYear && (
|
||||
<span
|
||||
className="absolute left-5 top-1/2 -translate-y-1/2 px-3 py-0.5 font-display text-sm font-bold text-white"
|
||||
className="absolute left-6 top-1/2 -translate-y-1/2 px-3 py-0.5 font-display text-sm font-bold text-white"
|
||||
style={{ background: BRAND }}
|
||||
>
|
||||
{year(item)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue