Compare commits
7 commits
bc88b45ee1
...
1da79c128b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1da79c128b | ||
|
|
8d319bcaaa | ||
|
|
a907a47c24 | ||
|
|
2a926971f7 | ||
|
|
177a65005e | ||
|
|
0f62b67ee0 | ||
|
|
01de6272f3 |
28 changed files with 949 additions and 127 deletions
|
|
@ -9,7 +9,8 @@
|
|||
<meta name="theme-color" content="#073d4a" media="(prefers-color-scheme: light)" />
|
||||
<meta name="theme-color" content="#0c1d21" media="(prefers-color-scheme: dark)" />
|
||||
<!-- Theme before first paint, so a dark visitor never sees a white
|
||||
flash: this browser's choice (ThemeToggle), else the system. -->
|
||||
flash: this browser's choice (ThemeToggle), else the system;
|
||||
and the accessibility choices, for the same reason. -->
|
||||
<script>
|
||||
try {
|
||||
// Once: browser keys used to start "ngu-"; move them to "site-"
|
||||
|
|
@ -25,6 +26,9 @@
|
|||
var t = localStorage.getItem("site-theme");
|
||||
document.documentElement.dataset.theme =
|
||||
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
// The accessibility panel's choices (AccessibilityPanel.tsx).
|
||||
if (localStorage.getItem("site-font") === "dyslexic") document.documentElement.dataset.font = "dyslexic";
|
||||
if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on";
|
||||
} catch (e) {}
|
||||
</script>
|
||||
<!-- site:head-end -->
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@fontsource/montserrat": "^5.3.0",
|
||||
"@fontsource/opendyslexic": "^5.3.0",
|
||||
"@fontsource/poppins": "^5.3.0",
|
||||
"@phosphor-icons/react": "^2.1.10",
|
||||
"qrcode": "^1.5.4",
|
||||
|
|
|
|||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
|
|
@ -11,6 +11,9 @@ importers:
|
|||
'@fontsource/montserrat':
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
'@fontsource/opendyslexic':
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
'@fontsource/poppins':
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
|
|
@ -66,6 +69,9 @@ packages:
|
|||
'@fontsource/montserrat@5.3.0':
|
||||
resolution: {integrity: sha512-iQPDtZOnmM5ih4JBGaMSXisRap0ixb9bAUw2hDtY7EjVfaqiiNlKtVuJl9XclxUwtwMMHNcWXfQR6zI9x05+Tg==}
|
||||
|
||||
'@fontsource/opendyslexic@5.3.0':
|
||||
resolution: {integrity: sha512-BVYIW/ghc1U2iAghhYTN+GFWiZ3lnCy8Jf2KkZC23aHQHBNcMqKT718zckfqVxRx4qsXJmIMPWvczirRuhmtsg==}
|
||||
|
||||
'@fontsource/poppins@5.3.0':
|
||||
resolution: {integrity: sha512-cms1nM7U6SN8epIV1WMVOV8VsA645aSm3wHfzIQnkk188U341ThbJGSl2Sv54V29gnDbT2arMPfLzvVIIVCceQ==}
|
||||
|
||||
|
|
@ -786,6 +792,8 @@ snapshots:
|
|||
|
||||
'@fontsource/montserrat@5.3.0': {}
|
||||
|
||||
'@fontsource/opendyslexic@5.3.0': {}
|
||||
|
||||
'@fontsource/poppins@5.3.0': {}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ const AdminHome = lazyPage(() => import("./pages/admin/AdminHome.tsx"))
|
|||
const AdminFeedback = lazyPage(() => import("./pages/admin/AdminFeedback.tsx"))
|
||||
const AdminMedia = lazyPage(() => import("./pages/admin/AdminMedia.tsx"))
|
||||
const AdminClips = lazyPage(() => import("./pages/admin/AdminClips.tsx"))
|
||||
const AdminNewsletter = lazyPage(() => import("./pages/admin/AdminNewsletter.tsx"))
|
||||
const EntityList = lazyPage(() => import("./pages/admin/EntityList.tsx"))
|
||||
const EntityEdit = lazyPage(() => import("./pages/admin/EntityEdit.tsx"))
|
||||
|
||||
|
|
@ -133,6 +134,7 @@ export default function App() {
|
|||
<Route path="data-requests" element={<AdminFeedback kind="privacy" />} />
|
||||
<Route path="requests" element={<AdminFeedback kind="content" />} />
|
||||
<Route path="media" element={<AdminMedia />} />
|
||||
<Route path="newsletter" element={<AdminNewsletter />} />
|
||||
<Route element={<RequireRole role="admin" />}>
|
||||
<Route path="clips" element={<AdminClips />} />
|
||||
</Route>
|
||||
|
|
|
|||
168
src/components/AccessibilityPanel.tsx
Normal file
168
src/components/AccessibilityPanel.tsx
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
ACCESSIBILITY PANEL
|
||||
|
||||
A button fixed to the bottom right of every public page, opening
|
||||
two switches that change how the whole site reads:
|
||||
|
||||
Dyslexia-friendly font every typeface becomes OpenDyslexic
|
||||
(self-hosted, index.css)
|
||||
Reading mode the design steps back: no background
|
||||
circles, motion or shadows, one column,
|
||||
larger text and plain underlined links,
|
||||
the same content throughout
|
||||
|
||||
Each is a data attribute on <html> (data-font, data-reading) that
|
||||
index.css styles, saved in this browser (site-font, site-reading)
|
||||
and set again before the first paint by index.html, so a page
|
||||
never flashes the other look. Blocked storage just means the
|
||||
choice lasts until the tab closes.
|
||||
|
||||
The panel closes on Escape, on the button again, or a click
|
||||
anywhere else, and gives focus back to the button.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { PersonArmsSpread, X } from '@phosphor-icons/react'
|
||||
import { useEffect, useId, useRef, useState } from 'react'
|
||||
|
||||
/* A setting: its <html> attribute, storage key, the value that turns
|
||||
it on, and its words. */
|
||||
const SETTINGS = [
|
||||
{
|
||||
attribute: 'font',
|
||||
key: 'site-font',
|
||||
on: 'dyslexic',
|
||||
label: 'Dyslexia-friendly font',
|
||||
help: 'Letters shaped to be easier to tell apart.',
|
||||
},
|
||||
{
|
||||
attribute: 'reading',
|
||||
key: 'site-reading',
|
||||
on: 'on',
|
||||
label: 'Reading mode',
|
||||
help: 'A plain, single column with larger text and no motion.',
|
||||
},
|
||||
] as const
|
||||
|
||||
type Setting = (typeof SETTINGS)[number]
|
||||
|
||||
const isOn = (setting: Setting) => document.documentElement.dataset[setting.attribute] === setting.on
|
||||
|
||||
function apply(setting: Setting, on: boolean) {
|
||||
const root = document.documentElement
|
||||
if (on) root.dataset[setting.attribute] = setting.on
|
||||
else delete root.dataset[setting.attribute]
|
||||
try {
|
||||
if (on) localStorage.setItem(setting.key, setting.on)
|
||||
else localStorage.removeItem(setting.key)
|
||||
} catch {
|
||||
// Storage blocked: the choice holds for this page view.
|
||||
}
|
||||
}
|
||||
|
||||
export default function AccessibilityPanel() {
|
||||
const [open, setOpen] = useState(false)
|
||||
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
|
||||
const rootRef = useRef<HTMLDivElement>(null)
|
||||
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||
const panelId = useId()
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return undefined
|
||||
const close = () => {
|
||||
setOpen(false)
|
||||
buttonRef.current?.focus()
|
||||
}
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') close()
|
||||
}
|
||||
const onPointer = (event: PointerEvent) => {
|
||||
if (!rootRef.current?.contains(event.target as Node)) setOpen(false)
|
||||
}
|
||||
document.addEventListener('keydown', onKey)
|
||||
document.addEventListener('pointerdown', onPointer)
|
||||
return () => {
|
||||
document.removeEventListener('keydown', onKey)
|
||||
document.removeEventListener('pointerdown', onPointer)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
const toggle = (setting: Setting) => {
|
||||
const next = !state[setting.key]
|
||||
apply(setting, next)
|
||||
setState((current) => ({ ...current, [setting.key]: next }))
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={rootRef} className="fixed right-4 bottom-4 z-50 print:hidden">
|
||||
{open && (
|
||||
<div
|
||||
id={panelId}
|
||||
role="region"
|
||||
aria-label="Accessibility"
|
||||
className="absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
|
||||
>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setOpen(false)
|
||||
buttonRef.current?.focus()
|
||||
}}
|
||||
className="btn flex h-10 w-10 items-center justify-center text-muted hover:bg-tint"
|
||||
aria-label="Close accessibility options"
|
||||
>
|
||||
<X size={18} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ul className="mt-3 space-y-3">
|
||||
{SETTINGS.map((setting) => {
|
||||
const on = state[setting.key]
|
||||
const labelId = `${panelId}-${setting.attribute}`
|
||||
return (
|
||||
<li key={setting.key} className="flex items-start gap-3">
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={on}
|
||||
aria-labelledby={labelId}
|
||||
onClick={() => toggle(setting)}
|
||||
className={`relative mt-0.5 h-6 w-11 shrink-0 rounded-full border-2 transition-colors ${
|
||||
on ? 'border-action bg-action' : 'border-muted/50 bg-surface'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`absolute top-0.5 h-4 w-4 rounded-full transition-transform ${
|
||||
on ? 'translate-x-5 bg-white' : 'translate-x-0.5 bg-muted'
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
<span>
|
||||
<span id={labelId} className="block font-semibold text-ink">
|
||||
{setting.label}
|
||||
</span>
|
||||
<span className="block text-sm text-muted">{setting.help}</span>
|
||||
</span>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
ref={buttonRef}
|
||||
type="button"
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
aria-expanded={open}
|
||||
aria-controls={open ? panelId : undefined}
|
||||
aria-label="Accessibility options"
|
||||
className="btn flex h-12 w-12 items-center justify-center bg-action text-white shadow-lg transition-colors hover:bg-action-hover"
|
||||
>
|
||||
<PersonArmsSpread size={26} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import { Link } from "react-router-dom";
|
|||
ARROW LINK
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export default function ArrowLink({ to, label, color, size = "h-9 w-9" }) {
|
||||
export default function ArrowLink({ to, label, color, size = "h-10 w-10" }) {
|
||||
return (
|
||||
<Link
|
||||
to={to}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,12 @@ export default function Banner() {
|
|||
|
||||
return (
|
||||
<div
|
||||
className="relative w-full px-12 py-2.5 text-center"
|
||||
style={{ background: "rgba(0, 47, 57, 0.95)" }}
|
||||
className="relative w-full py-2.5 pr-12 pl-4 text-center sm:px-12"
|
||||
style={{ background: "rgba(0, 16, 17, 0.95)" }}
|
||||
role="region"
|
||||
aria-label="Site announcement"
|
||||
>
|
||||
<p className="text-sm text-white/85">
|
||||
<p className="text-xs text-white/85 sm:text-sm">
|
||||
{SITE_BANNER.content.map((part, i) => {
|
||||
if (!part.href) return <span key={i}>{part.text}</span>;
|
||||
return part.external ? (
|
||||
|
|
@ -53,7 +53,7 @@ export default function Banner() {
|
|||
<button
|
||||
onClick={dismiss}
|
||||
aria-label="Dismiss announcement"
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 p-1.5 text-white/50 hover:text-white hover:bg-white/10 transition-colors"
|
||||
className="absolute right-1 top-1/2 -translate-y-1/2 p-3 text-white/50 hover:text-white hover:bg-white/10 transition-colors"
|
||||
>
|
||||
<X className="w-4 h-4" weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -34,11 +34,12 @@ const Footer_Links = [
|
|||
const footerLinkClass =
|
||||
"text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
|
||||
|
||||
// inline-block with a little height of its own, so a finger can hit it.
|
||||
const pageLinkClass =
|
||||
"text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors";
|
||||
"inline-block py-1 text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors";
|
||||
|
||||
const sectionLinkClass =
|
||||
"text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
|
||||
"inline-block py-1 text-white/65 hover:text-[#9cc47c] text-sm transition-colors";
|
||||
|
||||
const headingClass = "text-white/90 text-sm font-semibold mb-4";
|
||||
|
||||
|
|
@ -92,7 +93,7 @@ export default function Footer() {
|
|||
</Link>
|
||||
|
||||
{sections.length > 0 && (
|
||||
<ul className="mt-2 flex flex-col gap-1.5">
|
||||
<ul className="mt-1 flex flex-col">
|
||||
{sections.map((section) => (
|
||||
<li key={section.hash}>
|
||||
<Link
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import siteLogo from "../assets/logos/NGU_Logo.svg";
|
|||
import Footer from "./Footer.tsx";
|
||||
import PrivacyNotice from "./PrivacyNotice.tsx";
|
||||
import PageBackdrop from "./PageBackdrop.tsx";
|
||||
import AccessibilityPanel from "./AccessibilityPanel.tsx";
|
||||
import ThemeToggle from "./ThemeToggle.tsx";
|
||||
import { scrollBehavior } from "../lib/motion.ts";
|
||||
|
||||
|
|
@ -289,12 +290,13 @@ export default function Layout() {
|
|||
<div inert={mobileMenuOpen} className="print:hidden">
|
||||
<Footer />
|
||||
<PrivacyNotice />
|
||||
<AccessibilityPanel />
|
||||
</div>
|
||||
|
||||
{/* Mobile menu */}
|
||||
{mobileMenuOpen && (
|
||||
<div
|
||||
className="fixed inset-0 z-[60] flex flex-col items-center justify-center overflow-y-auto py-16"
|
||||
className="fixed inset-0 z-[60] flex flex-col items-center [justify-content:safe_center] overflow-y-auto py-16"
|
||||
style={{ background: "rgba(0, 58, 69, 0.97)" }}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
|
|
@ -302,7 +304,7 @@ export default function Layout() {
|
|||
>
|
||||
<button
|
||||
ref={closeMenuRef}
|
||||
className="absolute top-5 right-6 text-white text-3xl"
|
||||
className="absolute top-3 right-4 p-2 text-white text-3xl"
|
||||
aria-label="Close menu"
|
||||
onClick={() => setMobileMenuOpen(false)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
|
|||
{/* Page header */}
|
||||
<div className="pt-24 pb-12 px-6">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h1 className="text-5xl md:text-6xl font-bold" style={{ color: accentText(BRAND) }}>
|
||||
<h1 className="text-4xl sm:text-5xl md:text-6xl font-bold [overflow-wrap:anywhere] hyphens-auto" style={{ color: accentText(BRAND) }}>
|
||||
{title}
|
||||
</h1>
|
||||
{intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@
|
|||
border-left: 1px solid var(--pl-rule);
|
||||
}
|
||||
|
||||
/* Everyone on one line (fitsOneRow in PeopleTiles.tsx): the groups
|
||||
share it by head count, and the tiles narrow to fit. */
|
||||
.pl__groups[data-row="one"] {
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.pl__groups[data-row="one"] .pl__group {
|
||||
flex: var(--pl-share) 1 0;
|
||||
}
|
||||
|
||||
.pl__group-head {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
@ -304,27 +314,17 @@
|
|||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.pl__bio--anchored[data-align="end"] {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.pl__bio--anchored::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -11px;
|
||||
left: calc(var(--pl-w) / 2 - 8px);
|
||||
left: var(--pl-notch, calc(var(--pl-w) / 2 - 8px));
|
||||
width: 16px;
|
||||
height: 8px;
|
||||
background: var(--pl-accent);
|
||||
clip-path: polygon(50% 0, 100% 100%, 0 100%);
|
||||
}
|
||||
|
||||
.pl__bio--anchored[data-align="end"]::before {
|
||||
left: auto;
|
||||
right: calc(var(--pl-w) / 2 - 8px);
|
||||
}
|
||||
|
||||
.pl__bio {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
@ -356,8 +356,8 @@
|
|||
|
||||
.pl__close {
|
||||
flex: 0 0 auto;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border: 1px solid var(--pl-frame-edge);
|
||||
border-radius: var(--btn-radius);
|
||||
background: var(--color-surface);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,10 @@ import "./PeopleTiles.css";
|
|||
* Rows fill (balancedColumns): as many tiles across as fit, never
|
||||
* fewer than 2 or more than 10, one fewer when that would leave a
|
||||
* lone tile on the last row. When 2 don't fit at full size they
|
||||
* shrink.
|
||||
* shrink. And when everyone (every group, leads and members alike)
|
||||
* fits on one line with tiles at ONE_ROW_SHRINK of full width or
|
||||
* wider, they all share that one line instead (fitsOneRow): a
|
||||
* board of 7 reads as one row, not 5 and 2.
|
||||
*
|
||||
* Details open in a panel right under the tile, over what follows
|
||||
* (flipped to end at the tile's right edge when it would run off
|
||||
|
|
@ -484,6 +487,9 @@ export function PeopleTilesView({
|
|||
}
|
||||
|
||||
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
|
||||
const oneRow =
|
||||
room !== null && overflow !== "scroll" &&
|
||||
fitsOneRow(resolvedGroups.map((group) => group.people.length), room.width, room.tile, room.gap);
|
||||
const anchored = overflow !== "scroll";
|
||||
const closePanel = () => {
|
||||
setOpenKey(null);
|
||||
|
|
@ -537,13 +543,17 @@ export function PeopleTilesView({
|
|||
{...rest}
|
||||
>
|
||||
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
|
||||
<div className="pl__groups">
|
||||
<div className="pl__groups" data-row={oneRow ? "one" : undefined}>
|
||||
{resolvedGroups.map((group) => (
|
||||
<section
|
||||
key={group.id}
|
||||
className="pl__group"
|
||||
style={
|
||||
group.accent ? ({ "--pl-accent": group.accent } as CSSProperties) : undefined
|
||||
{
|
||||
...(group.accent ? { "--pl-accent": group.accent } : null),
|
||||
// Sharing one line: each group's width follows its head count.
|
||||
...(oneRow ? { "--pl-share": group.people.length } : null),
|
||||
} as CSSProperties
|
||||
}
|
||||
aria-label={group.label || undefined}
|
||||
>
|
||||
|
|
@ -559,7 +569,9 @@ export function PeopleTilesView({
|
|||
style={
|
||||
room
|
||||
? ({
|
||||
"--pl-cols": balancedColumns(group.people.length, room.width, room.tile, room.gap),
|
||||
"--pl-cols": oneRow
|
||||
? group.people.length
|
||||
: balancedColumns(group.people.length, room.width, room.tile, room.gap),
|
||||
} as CSSProperties)
|
||||
: undefined
|
||||
}
|
||||
|
|
@ -736,15 +748,23 @@ function DetailPanel({
|
|||
onClose: () => void;
|
||||
}) {
|
||||
const panelRef = useRef<HTMLDivElement>(null);
|
||||
const [alignEnd, setAlignEnd] = useState(false);
|
||||
// How far the panel shifts from the tile's left edge, and where the
|
||||
// notch sits on it, in px.
|
||||
const [place, setPlace] = useState<{ shift: number; notch: number } | null>(null);
|
||||
|
||||
// Under the tile, starting at its left edge unless that would run
|
||||
// off the right of the screen; then ending at its right edge.
|
||||
// Under the tile, starting at its left edge, slid left just enough
|
||||
// to stay 8px inside the screen on either side (a narrow phone
|
||||
// included), with the notch kept under the tile's middle.
|
||||
useLayoutEffect(() => {
|
||||
if (!anchored || !panelRef.current) return;
|
||||
const tile = panelRef.current.parentElement?.getBoundingClientRect();
|
||||
if (!tile) return;
|
||||
const width = panelRef.current.offsetWidth;
|
||||
if (tile) setAlignEnd(tile.left + width > document.documentElement.clientWidth - 16);
|
||||
const screen = document.documentElement.clientWidth;
|
||||
let shift = Math.min(0, screen - 8 - (tile.left + width));
|
||||
shift = Math.max(shift, 8 - tile.left);
|
||||
const notch = Math.min(Math.max(tile.width / 2 - shift - 8, 8), width - 24);
|
||||
setPlace({ shift, notch });
|
||||
}, [anchored]);
|
||||
|
||||
const org = resolveOrg(person.org);
|
||||
|
|
@ -758,10 +778,14 @@ function DetailPanel({
|
|||
ref={panelRef}
|
||||
id={id}
|
||||
className={anchored ? "pl__bio pl__bio--anchored" : "pl__bio"}
|
||||
data-align={alignEnd ? "end" : "start"}
|
||||
style={
|
||||
{
|
||||
...(tint ? { "--pl-accent": tint } : null),
|
||||
...(place ? { left: `${place.shift}px`, "--pl-notch": `${place.notch}px` } : null),
|
||||
} as CSSProperties
|
||||
}
|
||||
role="region"
|
||||
aria-label={`About ${person.name}`}
|
||||
style={tint ? ({ "--pl-accent": tint } as CSSProperties) : undefined}
|
||||
>
|
||||
<div className="pl__bio-head">
|
||||
<div>
|
||||
|
|
@ -834,17 +858,36 @@ function Chevron() {
|
|||
|
||||
/* ── Helpers ─────────────────────────────────────────────────── */
|
||||
|
||||
/* How small a tile may get so a whole list shares one line. */
|
||||
export const ONE_ROW_SHRINK = 0.75;
|
||||
|
||||
/* Whether every group fits side by side on one line, 10 tiles at most,
|
||||
with tiles no smaller than ONE_ROW_SHRINK of full width. Groups are
|
||||
divided by a gap, padding and a 1px rule (PeopleTiles.css). */
|
||||
export function fitsOneRow(counts: number[], width: number, tile: number, gap: number): boolean {
|
||||
const total = counts.reduce((sum, n) => sum + n, 0);
|
||||
if (total < 2 || total > 10) return false;
|
||||
const smallest = tile * ONE_ROW_SHRINK;
|
||||
const tiles = counts.reduce((sum, n) => sum + n * smallest + (n - 1) * gap, 0);
|
||||
const dividers = (counts.length - 1) * (gap * 3 + 1);
|
||||
return tiles + dividers <= width;
|
||||
}
|
||||
|
||||
/* Tiles across a row: as many as fit, at least 2 and at most 10
|
||||
(never more than there are). If that would leave one tile alone on
|
||||
the last row, one fewer across, so the last row has two: 7 that fit
|
||||
6 across go 5 and 2. With only 2 across, a third, narrower column
|
||||
takes the odd one instead (3 tiles on a phone go 3 across). */
|
||||
takes the odd one instead, if tiles stay at least 60% of full
|
||||
width; on a narrow phone a lone last tile beats three unreadable
|
||||
ones. */
|
||||
export function balancedColumns(count: number, width: number, tile: number, gap: number): number {
|
||||
if (count <= 1) return 1;
|
||||
const fit = Math.floor((width + gap) / (tile + gap));
|
||||
const cols = Math.min(count, 10, Math.max(2, fit));
|
||||
if (count % cols !== 1) return cols;
|
||||
return cols > 2 ? cols - 1 : Math.min(count, 3);
|
||||
if (cols > 2) return cols - 1;
|
||||
const third = (width - 2 * gap) / 3;
|
||||
return count >= 3 && third >= tile * 0.6 ? 3 : 2;
|
||||
}
|
||||
|
||||
/* A string id is a people slug; a numeric or missing one is a
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
tracking cookies, and videos and maps from other companies wait
|
||||
for a click (VideoPlayer, HeroStage, ScheduleBlock). Because
|
||||
nothing loads before that, a notice is enough, rather than a
|
||||
consent banner that blocks the page. If an embed ever loads on
|
||||
its own, or analytics are added, this has to become a real
|
||||
consent choice.
|
||||
consent banner that blocks the page. Analytics are Plausible,
|
||||
self-hosted and cookieless, which needs no consent either. If an
|
||||
embed ever loads on its own, or anything sets a tracking cookie,
|
||||
this has to become a real consent choice.
|
||||
|
||||
Closed is remembered in this browser; blocked storage just
|
||||
means it shows again next time.
|
||||
|
|
@ -42,7 +43,7 @@ export default function PrivacyNotice() {
|
|||
<div
|
||||
role="region"
|
||||
aria-label="Privacy notice"
|
||||
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||
className="fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||
>
|
||||
<p>
|
||||
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
||||
|
|
|
|||
|
|
@ -99,8 +99,10 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
|
||||
return (
|
||||
<li className="border-b border-brand/10 last:border-b-0">
|
||||
<div className="flex gap-4 py-4 sm:gap-6">
|
||||
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
|
||||
{/* On a phone the time sits on its own line above the entry,
|
||||
leaving the title the full width. */}
|
||||
<div className="flex flex-wrap gap-x-4 gap-y-1 py-4 sm:flex-nowrap sm:gap-6">
|
||||
<p className="w-full shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
|
||||
{entry.time}
|
||||
</p>
|
||||
|
||||
|
|
@ -131,7 +133,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
|
||||
className="h-8 w-8 shrink-0 btn border text-sm transition-colors hover:bg-tint"
|
||||
className="h-10 w-10 shrink-0 btn border text-sm transition-colors hover:bg-tint"
|
||||
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
|
||||
>
|
||||
<CaretDown
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
@import '@fontsource/poppins/600.css';
|
||||
@import '@fontsource/poppins/700.css';
|
||||
@import '@fontsource/poppins/800.css'; /* the front page's stat numbers only */
|
||||
@import '@fontsource/opendyslexic/400.css'; /* the accessibility panel's font, */
|
||||
@import '@fontsource/opendyslexic/700.css'; /* only downloaded when chosen */
|
||||
|
||||
@import 'tailwindcss';
|
||||
|
||||
|
|
@ -110,6 +112,13 @@ html {
|
|||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
/* An email address is one long word: let it break anywhere rather
|
||||
than push a button or card past a phone's edge. */
|
||||
a[href^="mailto:"] {
|
||||
overflow-wrap: anywhere;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* One visible focus ring for keyboard users, wherever a component
|
||||
doesn't draw its own. */
|
||||
:focus-visible {
|
||||
|
|
@ -209,6 +218,62 @@ iframe[src*="churchcenter"] {
|
|||
--btn-radius: 0.5rem;
|
||||
}
|
||||
|
||||
/* ── Accessibility choices (AccessibilityPanel.tsx) ──────────────
|
||||
Set on <html> before the first paint (index.html) and by the
|
||||
panel. */
|
||||
|
||||
/* Dyslexia-friendly font: every typeface, headings and buttons too. */
|
||||
:root[data-font="dyslexic"] {
|
||||
--font-display: 'OpenDyslexic', sans-serif;
|
||||
--font-body: 'OpenDyslexic', sans-serif;
|
||||
}
|
||||
:root[data-font="dyslexic"] body,
|
||||
:root[data-font="dyslexic"] h1,
|
||||
:root[data-font="dyslexic"] h2,
|
||||
:root[data-font="dyslexic"] h3,
|
||||
:root[data-font="dyslexic"] h4,
|
||||
:root[data-font="dyslexic"] h5,
|
||||
:root[data-font="dyslexic"] h6,
|
||||
:root[data-font="dyslexic"] button,
|
||||
:root[data-font="dyslexic"] input,
|
||||
:root[data-font="dyslexic"] textarea,
|
||||
:root[data-font="dyslexic"] select {
|
||||
font-family: 'OpenDyslexic', sans-serif;
|
||||
}
|
||||
|
||||
/* Reading mode: the same content with the design stepped back. No
|
||||
background circles, motion or shadows; every layout one column,
|
||||
narrower and larger, with plain underlined links. */
|
||||
:root[data-reading="on"] {
|
||||
font-size: 112.5%;
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
:root[data-reading="on"] .page-backdrop {
|
||||
display: none;
|
||||
}
|
||||
:root[data-reading="on"] *,
|
||||
:root[data-reading="on"] *::before,
|
||||
:root[data-reading="on"] *::after {
|
||||
animation: none !important;
|
||||
transition: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
:root[data-reading="on"] main {
|
||||
max-width: 48rem;
|
||||
margin-inline: auto;
|
||||
}
|
||||
:root[data-reading="on"] main .grid {
|
||||
grid-template-columns: minmax(0, 1fr) !important;
|
||||
}
|
||||
:root[data-reading="on"] main p,
|
||||
:root[data-reading="on"] main li {
|
||||
line-height: 1.75;
|
||||
}
|
||||
:root[data-reading="on"] main a {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 0.2em;
|
||||
}
|
||||
|
||||
/* A notice where content would be (an empty section, a form's
|
||||
note, "coming soon"): no box and no fill, just two thick brackets
|
||||
at opposite corners, top left and bottom right, like a
|
||||
|
|
@ -313,7 +378,10 @@ iframe[src*="churchcenter"] {
|
|||
@container (max-width: 30rem) {
|
||||
.ev-grid {
|
||||
grid-template-columns: 1fr;
|
||||
/* The logo gets its own row: without one, grid-area: image made
|
||||
an extra column beside the text. */
|
||||
grid-template-areas:
|
||||
"image"
|
||||
"org"
|
||||
"info"
|
||||
"desc";
|
||||
|
|
|
|||
147
src/lib/newsletter.ts
Normal file
147
src/lib/newsletter.ts
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
NEWSLETTER: email-ready HTML and plain text from picked items
|
||||
|
||||
The admin's Newsletter tool (AdminNewsletter.tsx) gathers events,
|
||||
blog posts and featured cards; this turns them into one email to
|
||||
paste into Mailchimp, Gmail or Church Center. Nothing is sent or
|
||||
stored here.
|
||||
|
||||
Email clients ignore stylesheets, CSS variables and most layout,
|
||||
so the HTML is tables with inline styles at 600px, images with
|
||||
width and alt, and the palette written out as hex (the one place
|
||||
the site's colors are literals: an inbox has no theme tokens). A
|
||||
plain-text copy goes alongside for clients that show no HTML.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export type NewsletterItem = {
|
||||
title: string
|
||||
/** A line under the title: dates and place, a byline. */
|
||||
meta?: string | null
|
||||
text?: string | null
|
||||
/** An absolute image URL. */
|
||||
image?: string | null
|
||||
/** An absolute link. */
|
||||
href: string
|
||||
cta: string
|
||||
}
|
||||
|
||||
export type NewsletterSection = { heading: string; items: NewsletterItem[] }
|
||||
|
||||
export type Newsletter = {
|
||||
title: string
|
||||
intro?: string | null
|
||||
sections: NewsletterSection[]
|
||||
/** The site's address, for the header link and footer. */
|
||||
origin: string
|
||||
siteName: string
|
||||
/** An absolute URL of the logo for the header. */
|
||||
logo?: string | null
|
||||
}
|
||||
|
||||
/* The palette as an inbox needs it. */
|
||||
const COLOR = {
|
||||
ink: '#001011',
|
||||
body: '#003a45',
|
||||
muted: '#3b5456',
|
||||
teal: '#00748a',
|
||||
page: '#f5f9f8',
|
||||
card: '#ffffff',
|
||||
rule: '#d6f5fa',
|
||||
}
|
||||
|
||||
const FONT = "'Poppins', Helvetica, Arial, sans-serif"
|
||||
const BODY_FONT = "'Montserrat', Helvetica, Arial, sans-serif"
|
||||
|
||||
const escape = (value: string) =>
|
||||
value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
|
||||
|
||||
/* Paragraphs from text with blank lines between them. */
|
||||
const paragraphs = (text: string, style: string) =>
|
||||
text
|
||||
.split(/\n\s*\n/)
|
||||
.map((part) => part.trim())
|
||||
.filter(Boolean)
|
||||
.map((part) => `<p style="${style}">${escape(part).replace(/\n/g, '<br>')}</p>`)
|
||||
.join('')
|
||||
|
||||
function itemHtml(item: NewsletterItem): string {
|
||||
const image = item.image
|
||||
? `<tr><td><a href="${escape(item.href)}"><img src="${escape(item.image)}" width="552" alt="" style="display:block;width:100%;max-width:552px;height:auto;border:0;"></a></td></tr>`
|
||||
: ''
|
||||
const meta = item.meta
|
||||
? `<p style="margin:4px 0 0;font-family:${BODY_FONT};font-size:14px;line-height:20px;color:${COLOR.muted};">${escape(item.meta)}</p>`
|
||||
: ''
|
||||
const text = item.text
|
||||
? paragraphs(item.text, `margin:12px 0 0;font-family:${BODY_FONT};font-size:15px;line-height:24px;color:${COLOR.body};`)
|
||||
: ''
|
||||
return `
|
||||
<tr><td style="padding:0 24px 24px;">
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:${COLOR.card};border-left:4px solid ${COLOR.teal};">
|
||||
${image}
|
||||
<tr><td style="padding:20px 24px 24px;">
|
||||
<h3 style="margin:0;font-family:${FONT};font-size:20px;line-height:26px;font-weight:700;color:${COLOR.ink};"><a href="${escape(item.href)}" style="color:${COLOR.ink};text-decoration:none;">${escape(item.title)}</a></h3>
|
||||
${meta}${text}
|
||||
<p style="margin:16px 0 0;"><a href="${escape(item.href)}" style="display:inline-block;padding:10px 20px;border-radius:8px;background:${COLOR.teal};color:#ffffff;font-family:${FONT};font-size:14px;font-weight:700;text-decoration:none;">${escape(item.cta)}</a></p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>`
|
||||
}
|
||||
|
||||
export function newsletterHtml(n: Newsletter): string {
|
||||
const sections = n.sections
|
||||
.filter((section) => section.items.length > 0)
|
||||
.map(
|
||||
(section) => `
|
||||
<tr><td style="padding:16px 24px 12px;">
|
||||
<h2 style="margin:0;padding-bottom:8px;border-bottom:2px solid ${COLOR.rule};font-family:${FONT};font-size:22px;line-height:28px;font-weight:700;color:${COLOR.teal};">${escape(section.heading)}</h2>
|
||||
</td></tr>${section.items.map(itemHtml).join('')}`,
|
||||
)
|
||||
.join('')
|
||||
|
||||
const logo = n.logo
|
||||
? `<a href="${escape(n.origin)}"><img src="${escape(n.logo)}" height="48" alt="${escape(n.siteName)}" style="display:block;height:48px;width:auto;border:0;"></a>`
|
||||
: `<a href="${escape(n.origin)}" style="font-family:${FONT};font-size:18px;font-weight:700;color:#ffffff;text-decoration:none;">${escape(n.siteName)}</a>`
|
||||
|
||||
return `<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>${escape(n.title)}</title>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;background:${COLOR.page};">
|
||||
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:${COLOR.page};">
|
||||
<tr><td align="center" style="padding:24px 12px;">
|
||||
<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="width:100%;max-width:600px;background:${COLOR.page};">
|
||||
<tr><td style="padding:20px 24px;background:${COLOR.body};">${logo}</td></tr>
|
||||
<tr><td style="padding:28px 24px 8px;">
|
||||
<h1 style="margin:0;font-family:${FONT};font-size:28px;line-height:34px;font-weight:700;color:${COLOR.ink};">${escape(n.title)}</h1>
|
||||
${n.intro ? paragraphs(n.intro, `margin:12px 0 0;font-family:${BODY_FONT};font-size:16px;line-height:26px;color:${COLOR.body};`) : ''}
|
||||
</td></tr>
|
||||
${sections}
|
||||
<tr><td style="padding:24px;border-top:2px solid ${COLOR.rule};font-family:${BODY_FONT};font-size:13px;line-height:20px;color:${COLOR.muted};">
|
||||
${escape(n.siteName)}<br><a href="${escape(n.origin)}" style="color:${COLOR.teal};">${escape(n.origin.replace(/^https?:\/\//, ''))}</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>`
|
||||
}
|
||||
|
||||
export function newsletterText(n: Newsletter): string {
|
||||
const lines = [n.title, '='.repeat(Math.min(n.title.length, 60)), '']
|
||||
if (n.intro) lines.push(n.intro.trim(), '')
|
||||
for (const section of n.sections) {
|
||||
if (section.items.length === 0) continue
|
||||
lines.push(section.heading.toUpperCase(), '')
|
||||
for (const item of section.items) {
|
||||
lines.push(item.title)
|
||||
if (item.meta) lines.push(item.meta)
|
||||
if (item.text) lines.push(item.text.trim())
|
||||
lines.push(`${item.cta}: ${item.href}`, '')
|
||||
}
|
||||
}
|
||||
lines.push('--', n.siteName, n.origin)
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
|
@ -7,4 +7,4 @@
|
|||
box or a build banner can read the same value later.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
export const SITE_VERSION = "NGU-Web.v1.10.3";
|
||||
export const SITE_VERSION = "NGU-Web.v1.10.4";
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const PAGE = sitePage("/privacy");
|
|||
'privacy', in Admin → Forms → Data requests.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
const LAST_UPDATED = "September 29, 2026";
|
||||
const LAST_UPDATED = "September 30, 2026";
|
||||
|
||||
const link = "underline underline-offset-2 text-link";
|
||||
|
||||
|
|
@ -105,8 +105,13 @@ const PARTS: LegalPart[] = [
|
|||
],
|
||||
list: [
|
||||
<>
|
||||
<strong>Giving</strong> is handled by Church Center (Planning Center). Payment details go to them,
|
||||
not to us.
|
||||
<strong>Giving</strong> is handled by Church Center (Planning Center), at{" "}
|
||||
<a href="https://ngu.churchcenteronline.com" className="text-link underline underline-offset-2">
|
||||
ngu.churchcenteronline.com
|
||||
</a>
|
||||
. Payment details go to them, not to us. Church Center's script loads when you open our Giving page,
|
||||
and its giving form opens when you press Give; Church Center may use Google Analytics in that form,
|
||||
under its own privacy policy.
|
||||
</>,
|
||||
<>
|
||||
<strong>Videos</strong> come from YouTube, Facebook or Vimeo, and <strong>maps</strong> from Google
|
||||
|
|
@ -132,7 +137,7 @@ const PARTS: LegalPart[] = [
|
|||
id: "cookies",
|
||||
heading: "Cookies and browser storage",
|
||||
body: [
|
||||
"This site doesn't use advertising, analytics or tracking cookies. It keeps a few small things in your own browser so it works the way you left it:",
|
||||
"This site doesn't use advertising or tracking cookies, and doesn't use Google Analytics. To see which pages are read, we use Plausible Analytics, which we host ourselves on our own server: it sets no cookies, doesn't follow you across sites, and keeps no personal information, only counts of visits to each page; nothing from it is shared or sold. The site also keeps a few small things in your own browser so it works the way you left it:",
|
||||
],
|
||||
list: [
|
||||
"That you closed the announcement banner or the privacy notice.",
|
||||
|
|
|
|||
292
src/pages/admin/AdminNewsletter.tsx
Normal file
292
src/pages/admin/AdminNewsletter.tsx
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
NEWSLETTER (Tools)
|
||||
|
||||
Builds an email newsletter from what's already on the site: tick
|
||||
upcoming events, published blog posts and the front page's
|
||||
featured cards, write a title and an intro, and copy the result,
|
||||
email-ready HTML or plain text, into Mailchimp, Gmail or Church
|
||||
Center (or download it as a file). Nothing is sent or saved here;
|
||||
the builder is src/lib/newsletter.ts.
|
||||
|
||||
Picked blog posts are read from their public pages, so only a
|
||||
post visitors can open makes it in, with its excerpt and cover.
|
||||
Links and images are the live site's (SITE_ORIGIN), since an
|
||||
email is read far from this admin.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { Check, Copy, DownloadSimple } from '@phosphor-icons/react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
|
||||
import { get } from '../../lib/api.ts'
|
||||
import { useEvents } from '../../lib/eventData.ts'
|
||||
import { useFrontPage, type FeaturedCard } from '../../lib/useFrontPage.ts'
|
||||
import type { BlogPostRecord } from '../../lib/useBlog.ts'
|
||||
import { blogHref, eventHref, refHref } from '../../lib/hrefs.ts'
|
||||
import { mediaUrl } from '../../lib/media.ts'
|
||||
import { SITE_NAME, SITE_ORIGIN, siteUrl } from '../../lib/site.ts'
|
||||
import { seriesLabel } from '../../lib/eventSeries.ts'
|
||||
import { useWideAdminPage } from '../../lib/adminWidth.tsx'
|
||||
import { newsletterHtml, newsletterText, type NewsletterItem } from '../../lib/newsletter.ts'
|
||||
|
||||
const MUTED = 'var(--color-muted)'
|
||||
const input =
|
||||
'w-full border border-muted/25 bg-surface px-3 py-2 text-sm text-body outline-none focus:border-brand focus:ring-2 focus:ring-brand/25'
|
||||
const button =
|
||||
'btn inline-flex items-center gap-2 border border-brand px-4 py-2 text-sm text-link transition-colors hover:bg-tint disabled:opacity-50'
|
||||
|
||||
/* An address on the live site, whatever it started as. */
|
||||
const absolute = (path: string | null | undefined) => (path ? siteUrl(path) : null)
|
||||
const imageFor = (file: string | null | undefined) => absolute(mediaUrl(file))
|
||||
|
||||
type PostRow = { id: string; title: string; published_on?: string | null; is_published: number; is_listed: number }
|
||||
|
||||
function featuredHref(card: FeaturedCard): string | null {
|
||||
if (card.kind === 'record' && card.ref) return refHref(card.ref.kind, card.ref.id, card.ref.org_kind)
|
||||
return card.url
|
||||
}
|
||||
|
||||
export default function AdminNewsletter() {
|
||||
useWideAdminPage()
|
||||
const [title, setTitle] = useState('')
|
||||
const [intro, setIntro] = useState('')
|
||||
const [pickedEvents, setPickedEvents] = useState<Set<string>>(new Set())
|
||||
const [pickedPosts, setPickedPosts] = useState<Set<string>>(new Set())
|
||||
const [pickedCards, setPickedCards] = useState<Set<number>>(new Set())
|
||||
const [posts, setPosts] = useState<PostRow[] | null>(null)
|
||||
const [postDetails, setPostDetails] = useState<Record<string, BlogPostRecord>>({})
|
||||
const [copied, setCopied] = useState<'html' | 'text' | null>(null)
|
||||
|
||||
const { events, loading: eventsLoading } = useEvents({ status: 'upcoming' })
|
||||
const { data: frontPage } = useFrontPage()
|
||||
const cards = frontPage?.featured ?? []
|
||||
|
||||
useEffect(() => {
|
||||
get('/admin/blog_posts?limit=200', { ttl: 0 })
|
||||
.then((data: { rows: PostRow[] }) => setPosts(data.rows.filter((row) => row.is_published && row.is_listed)))
|
||||
.catch(() => setPosts([]))
|
||||
}, [])
|
||||
|
||||
// A picked post's public page: its excerpt and cover, and proof it's live.
|
||||
useEffect(() => {
|
||||
for (const id of pickedPosts) {
|
||||
if (postDetails[id]) continue
|
||||
get(`/blog/${encodeURIComponent(id)}`)
|
||||
.then((data: { post: BlogPostRecord }) => setPostDetails((current) => ({ ...current, [id]: data.post })))
|
||||
.catch(() => {})
|
||||
}
|
||||
}, [pickedPosts, postDetails])
|
||||
|
||||
const toggle = <T,>(set: Set<T>, value: T, update: (next: Set<T>) => void) => {
|
||||
const next = new Set(set)
|
||||
if (next.has(value)) next.delete(value)
|
||||
else next.add(value)
|
||||
update(next)
|
||||
}
|
||||
|
||||
const newsletter = useMemo(() => {
|
||||
const eventItems: NewsletterItem[] = events
|
||||
.filter((event) => pickedEvents.has(event.id))
|
||||
.map((event) => ({
|
||||
title: event.title,
|
||||
meta: [seriesLabel(event.series, event.starts_on) ?? event.date_label, event.is_online && !event.location_label ? 'Online' : event.location_label]
|
||||
.filter(Boolean)
|
||||
.join(', '),
|
||||
text: event.tagline ?? event.description?.[0] ?? null,
|
||||
image: imageFor(event.card_image),
|
||||
href: siteUrl(eventHref(event.id)),
|
||||
cta: 'Event details',
|
||||
}))
|
||||
|
||||
const postItems: NewsletterItem[] = (posts ?? [])
|
||||
.filter((row) => pickedPosts.has(row.id) && postDetails[row.id])
|
||||
.map((row) => {
|
||||
const post = postDetails[row.id]
|
||||
const byline = post.authors.map((a) => a.name).concat(post.guest ? [post.guest.name] : []).join(', ')
|
||||
return {
|
||||
title: post.title,
|
||||
meta: byline ? `By ${byline}` : null,
|
||||
text: post.excerpt ?? null,
|
||||
image: imageFor(post.cover_image),
|
||||
href: siteUrl(blogHref(post.id)),
|
||||
cta: 'Read the post',
|
||||
}
|
||||
})
|
||||
|
||||
const cardItems: NewsletterItem[] = cards
|
||||
.map((card, index) => ({ card, index, href: featuredHref(card) }))
|
||||
.filter(({ index, href }) => pickedCards.has(index) && href)
|
||||
.map(({ card, href }) => ({
|
||||
title: card.title ?? 'Featured',
|
||||
meta: card.eyebrow ?? null,
|
||||
text: card.blurb ?? null,
|
||||
image: card.image ? imageFor(card.image.file) : null,
|
||||
href: absolute(href) ?? href!,
|
||||
cta: card.kind === 'video' ? 'Watch' : 'Learn more',
|
||||
}))
|
||||
|
||||
const content = {
|
||||
title: title.trim() || `News from ${SITE_NAME}`,
|
||||
intro: intro.trim() || null,
|
||||
origin: SITE_ORIGIN,
|
||||
siteName: SITE_NAME,
|
||||
// The site's logo is an SVG, which Gmail and Outlook don't show,
|
||||
// so the header is the site name in type. A PNG logo could go here.
|
||||
logo: null,
|
||||
sections: [
|
||||
{ heading: 'Coming up', items: eventItems },
|
||||
{ heading: 'From the blog', items: postItems },
|
||||
{ heading: 'Featured', items: cardItems },
|
||||
],
|
||||
}
|
||||
return { html: newsletterHtml(content), text: newsletterText(content), count: eventItems.length + postItems.length + cardItems.length }
|
||||
}, [title, intro, events, pickedEvents, posts, pickedPosts, postDetails, cards, pickedCards])
|
||||
|
||||
async function copy(kind: 'html' | 'text') {
|
||||
try {
|
||||
await navigator.clipboard.writeText(kind === 'html' ? newsletter.html : newsletter.text)
|
||||
setCopied(kind)
|
||||
window.setTimeout(() => setCopied(null), 2000)
|
||||
} catch {
|
||||
setCopied(null)
|
||||
}
|
||||
}
|
||||
|
||||
function download() {
|
||||
const blob = new Blob([newsletter.html], { type: 'text/html' })
|
||||
const link = document.createElement('a')
|
||||
link.href = URL.createObjectURL(blob)
|
||||
link.download = `newsletter-${new Date().toISOString().slice(0, 10)}.html`
|
||||
link.click()
|
||||
URL.revokeObjectURL(link.href)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex flex-wrap items-baseline gap-3">
|
||||
<h1 className="text-2xl font-bold text-link">Newsletter</h1>
|
||||
<p className="text-sm" style={{ color: MUTED }}>
|
||||
Pick what to include, then copy the email into Mailchimp, Gmail or Church Center.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 grid gap-8 lg:grid-cols-[minmax(0,26rem)_minmax(0,1fr)]">
|
||||
<div className="space-y-6">
|
||||
<section className="space-y-3 border-l-4 border-brand bg-raised p-5 shadow-sm">
|
||||
<label className="block text-sm font-semibold text-body">
|
||||
Title
|
||||
<input value={title} onChange={(e) => setTitle(e.target.value)} placeholder={`News from ${SITE_NAME}`} className={`mt-1 ${input}`} />
|
||||
</label>
|
||||
<label className="block text-sm font-semibold text-body">
|
||||
Intro
|
||||
<textarea
|
||||
value={intro}
|
||||
onChange={(e) => setIntro(e.target.value)}
|
||||
rows={4}
|
||||
placeholder="eg. A few things coming up this month…"
|
||||
className={`mt-1 resize-y ${input}`}
|
||||
/>
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<PickList
|
||||
title="Upcoming events"
|
||||
empty={eventsLoading ? 'Loading…' : 'No upcoming events.'}
|
||||
options={events.map((event) => ({ value: event.id, label: event.title, detail: event.date_label }))}
|
||||
picked={pickedEvents}
|
||||
onToggle={(value) => toggle(pickedEvents, value, setPickedEvents)}
|
||||
/>
|
||||
<PickList
|
||||
title="Blog posts"
|
||||
empty={posts ? 'No published posts.' : 'Loading…'}
|
||||
options={(posts ?? []).map((post) => ({ value: post.id, label: post.title, detail: post.published_on }))}
|
||||
picked={pickedPosts}
|
||||
onToggle={(value) => toggle(pickedPosts, value, setPickedPosts)}
|
||||
/>
|
||||
<PickList
|
||||
title="Featured cards (front page)"
|
||||
empty="No featured cards."
|
||||
options={cards.map((card, index) => ({ value: index, label: card.title ?? card.url ?? 'Card', detail: card.kind }))}
|
||||
picked={pickedCards}
|
||||
onToggle={(value) => toggle(pickedCards, value, setPickedCards)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<button type="button" onClick={() => copy('html')} className={button} disabled={newsletter.count === 0}>
|
||||
{copied === 'html' ? <Check weight="bold" aria-hidden="true" /> : <Copy weight="bold" aria-hidden="true" />}
|
||||
{copied === 'html' ? 'Copied' : 'Copy HTML'}
|
||||
</button>
|
||||
<button type="button" onClick={() => copy('text')} className={button} disabled={newsletter.count === 0}>
|
||||
{copied === 'text' ? <Check weight="bold" aria-hidden="true" /> : <Copy weight="bold" aria-hidden="true" />}
|
||||
{copied === 'text' ? 'Copied' : 'Copy plain text'}
|
||||
</button>
|
||||
<button type="button" onClick={download} className={button} disabled={newsletter.count === 0}>
|
||||
<DownloadSimple weight="bold" aria-hidden="true" />
|
||||
Download .html
|
||||
</button>
|
||||
</div>
|
||||
<p className="mt-2 text-xs" style={{ color: MUTED }}>
|
||||
{newsletter.count === 0
|
||||
? 'Tick at least one item to build the email.'
|
||||
: `${newsletter.count} item${newsletter.count === 1 ? '' : 's'}. In Mailchimp, paste the HTML into a Code block or "Paste in code".`}
|
||||
</p>
|
||||
<iframe
|
||||
title="Newsletter preview"
|
||||
srcDoc={newsletter.html}
|
||||
sandbox=""
|
||||
className="mt-4 h-[70vh] w-full border border-brand/20 bg-white"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function PickList<T extends string | number>({
|
||||
title,
|
||||
empty,
|
||||
options,
|
||||
picked,
|
||||
onToggle,
|
||||
}: {
|
||||
title: string
|
||||
empty: string
|
||||
options: Array<{ value: T; label: string; detail?: string | null }>
|
||||
picked: Set<T>
|
||||
onToggle: (value: T) => void
|
||||
}) {
|
||||
return (
|
||||
<section className="border-l-4 border-brand bg-raised p-5 shadow-sm">
|
||||
<h2 className="text-base font-bold text-ink">{title}</h2>
|
||||
{options.length === 0 ? (
|
||||
<p className="mt-2 text-sm" style={{ color: MUTED }}>
|
||||
{empty}
|
||||
</p>
|
||||
) : (
|
||||
<ul className="mt-2 max-h-72 space-y-1 overflow-y-auto">
|
||||
{options.map((option) => (
|
||||
<li key={String(option.value)}>
|
||||
<label className="flex cursor-pointer items-start gap-3 px-2 py-1.5 hover:bg-tint-soft">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={picked.has(option.value)}
|
||||
onChange={() => onToggle(option.value)}
|
||||
className="mt-1 h-4 w-4 accent-[var(--color-action)]"
|
||||
/>
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm text-ink">{option.label}</span>
|
||||
{option.detail && (
|
||||
<span className="block text-xs" style={{ color: MUTED }}>
|
||||
{option.detail}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
|
@ -148,6 +148,11 @@ export const TOOLS_NAV = {
|
|||
blurb: "Cut clips from our YouTube and Facebook videos: trimmed, reshaped for Reels, or audio only.",
|
||||
minRole: "admin",
|
||||
},
|
||||
{
|
||||
to: "/admin/newsletter",
|
||||
label: "Newsletter",
|
||||
blurb: "An email newsletter from upcoming events, blog posts and featured cards, ready to paste into Mailchimp or Gmail.",
|
||||
},
|
||||
{
|
||||
to: "/qr",
|
||||
label: "QR code generator",
|
||||
|
|
|
|||
|
|
@ -190,25 +190,25 @@ export function Card({
|
|||
// past event) keeps its links out of the tab order too.
|
||||
inert={!interactive}
|
||||
>
|
||||
<div className={`flex-1 flex flex-col ${compact ? "p-8" : "p-10"}`}>
|
||||
<div className={`flex-1 flex flex-col ${compact ? "p-6 sm:p-8" : "p-6 sm:p-10"}`}>
|
||||
{compact ? (
|
||||
/* ── GRID CARD: layout driven by .ev-grid container queries ── */
|
||||
<div className="ev-grid mb-2">
|
||||
<Logo src={orgLogo} className="ev-org h-11 w-auto mb-4" />
|
||||
<div className="ev-info">
|
||||
{typeBadge}
|
||||
<h3 className="text-3xl font-bold leading-tight">
|
||||
<h3 className="text-2xl sm:text-3xl font-bold leading-tight [overflow-wrap:anywhere]">
|
||||
<TitleLink ev={ev} linked={linked}>
|
||||
{ev.title}
|
||||
</TitleLink>
|
||||
</h3>
|
||||
{ev.theme && (
|
||||
<p className="text-xl font-normal font-bold">"{ev.theme}"</p>
|
||||
<p className="text-lg sm:text-xl font-bold">"{ev.theme}"</p>
|
||||
)}
|
||||
{ev.date_label && <p className="text-xl">{ev.date_label}</p>}
|
||||
{schedule && <p className="text-xl">{schedule}</p>}
|
||||
{ev.date_label && <p className="text-lg sm:text-xl">{ev.date_label}</p>}
|
||||
{schedule && <p className="text-lg sm:text-xl">{schedule}</p>}
|
||||
{ev.location_label && (
|
||||
<p className="text-xl">{ev.location_label}</p>
|
||||
<p className="text-lg sm:text-xl">{ev.location_label}</p>
|
||||
)}
|
||||
</div>
|
||||
<Logo
|
||||
|
|
@ -225,18 +225,18 @@ export function Card({
|
|||
<div className="md:col-span-2">
|
||||
<Logo src={orgLogo} className="h-15 w-auto mb-6" />
|
||||
{typeBadge}
|
||||
<h3 className="text-4xl font-bold">
|
||||
<h3 className="text-2xl sm:text-4xl font-bold [overflow-wrap:anywhere]">
|
||||
<TitleLink ev={ev} linked={linked}>
|
||||
{ev.title}
|
||||
</TitleLink>
|
||||
</h3>
|
||||
{ev.theme && (
|
||||
<p className="text-2xl font-normal font-bold">"{ev.theme}"</p>
|
||||
<p className="text-lg sm:text-2xl font-bold">"{ev.theme}"</p>
|
||||
)}
|
||||
{ev.date_label && <p className="text-2xl">{ev.date_label}</p>}
|
||||
{schedule && <p className="text-2xl">{schedule}</p>}
|
||||
{ev.date_label && <p className="text-lg sm:text-2xl">{ev.date_label}</p>}
|
||||
{schedule && <p className="text-lg sm:text-2xl">{schedule}</p>}
|
||||
{ev.location_label && (
|
||||
<p className="text-2xl">{ev.location_label}</p>
|
||||
<p className="text-lg sm:text-2xl">{ev.location_label}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="md:col-span-1 flex items-center justify-end">
|
||||
|
|
@ -496,6 +496,18 @@ export default function EventListCards({
|
|||
const prev = () => setIndex(i => Math.max(0, i - 1));
|
||||
const next = () => setIndex(i => Math.min(events.length - 1, i + 1));
|
||||
|
||||
// A sideways swipe of 40px or more on a touch screen turns the carousel.
|
||||
const swipeFrom = useRef<number | null>(null);
|
||||
const onTouchStart = (e: React.TouchEvent) => { swipeFrom.current = e.touches[0]?.clientX ?? null; };
|
||||
const onTouchEnd = (e: React.TouchEvent) => {
|
||||
const from = swipeFrom.current;
|
||||
swipeFrom.current = null;
|
||||
const to = e.changedTouches[0]?.clientX;
|
||||
if (from == null || to == null || Math.abs(to - from) < 40) return;
|
||||
if (to < from) next();
|
||||
else prev();
|
||||
};
|
||||
|
||||
// Arrows and dots follow the section accent, not the active card.
|
||||
const arrowStyle = enabled => ({
|
||||
border: `1px solid ${accent}`,
|
||||
|
|
@ -616,7 +628,7 @@ export default function EventListCards({
|
|||
<button
|
||||
onClick={() => setShowPast(v => !v)}
|
||||
aria-expanded={showPast}
|
||||
className="flex items-center gap-2 py-2.5 px-6 font-bold transition-all duration-200 hover:scale-105"
|
||||
className="btn flex items-center gap-2 py-2.5 px-6 transition-all duration-200 hover:scale-105"
|
||||
style={{ border: `1px solid ${accent}`, color: accentText(accent) }}
|
||||
>
|
||||
{showPast
|
||||
|
|
@ -631,7 +643,7 @@ export default function EventListCards({
|
|||
) : (
|
||||
/* ── CAROUSEL VIEW ── */
|
||||
<>
|
||||
<div className="relative mb-6">
|
||||
<div className="relative mb-6" onTouchStart={onTouchStart} onTouchEnd={onTouchEnd}>
|
||||
<div
|
||||
className="overflow-hidden"
|
||||
style={{ maskImage: EDGE_FADE, WebkitMaskImage: EDGE_FADE }}
|
||||
|
|
@ -673,7 +685,7 @@ export default function EventListCards({
|
|||
onClick={prev}
|
||||
disabled={index === 0}
|
||||
aria-label="Previous event"
|
||||
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
|
||||
className="absolute left-2 md:left-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
|
||||
style={arrowStyle(index > 0)}
|
||||
>
|
||||
<CaretLeft size={20} weight="bold" aria-hidden="true" />
|
||||
|
|
@ -682,7 +694,7 @@ export default function EventListCards({
|
|||
onClick={next}
|
||||
disabled={index === events.length - 1}
|
||||
aria-label="Next event"
|
||||
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
|
||||
className="absolute right-2 md:right-6 top-1/2 -translate-y-1/2 z-10 h-12 w-12 btn hidden sm:flex items-center justify-center text-2xl shadow-lg transition-all duration-200 hover:scale-110 disabled:hover:scale-100"
|
||||
style={arrowStyle(index < events.length - 1)}
|
||||
>
|
||||
<CaretRight size={20} weight="bold" aria-hidden="true" />
|
||||
|
|
@ -692,20 +704,45 @@ export default function EventListCards({
|
|||
</div>
|
||||
|
||||
{events.length > 1 && (
|
||||
<div className="flex justify-center gap-2">
|
||||
<div className="flex flex-wrap items-center justify-center">
|
||||
{/* On a phone the side arrows would sit on the card's text,
|
||||
so they move down here, beside the dots. */}
|
||||
<button
|
||||
onClick={prev}
|
||||
disabled={index === 0}
|
||||
aria-label="Previous event"
|
||||
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
|
||||
style={arrowStyle(index > 0)}
|
||||
>
|
||||
<CaretLeft size={18} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
{events.map((e, i) => (
|
||||
<button
|
||||
key={e.id}
|
||||
onClick={() => setIndex(i)}
|
||||
aria-label={`Go to ${e.title}`}
|
||||
aria-current={i === index ? "true" : undefined}
|
||||
className="h-2.5 rounded-full transition-all duration-200"
|
||||
style={{
|
||||
width: i === index ? "1.5rem" : "0.625rem",
|
||||
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
|
||||
}}
|
||||
/>
|
||||
// A 40px tap target around the small dot it draws.
|
||||
className="flex h-10 items-center px-1"
|
||||
>
|
||||
<span
|
||||
className="block h-2.5 rounded-full transition-all duration-200"
|
||||
style={{
|
||||
width: i === index ? "1.5rem" : "0.625rem",
|
||||
background: i === index ? accent : withAlpha("var(--color-muted)", 40),
|
||||
}}
|
||||
/>
|
||||
</button>
|
||||
))}
|
||||
<button
|
||||
onClick={next}
|
||||
disabled={index === events.length - 1}
|
||||
aria-label="Next event"
|
||||
className="btn flex h-10 w-10 items-center justify-center sm:hidden"
|
||||
style={arrowStyle(index < events.length - 1)}
|
||||
>
|
||||
<CaretRight size={18} weight="bold" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ function OrgCard({ org, accent, pageLabel, siteLabel }) {
|
|||
|
||||
return (
|
||||
<div
|
||||
className="p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
|
||||
className="p-4 sm:p-6 h-full flex flex-col transition-transform duration-200 hover:scale-[1.01]"
|
||||
style={{ border: `1px solid ${color}`, background: "var(--color-surface)" }}
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<OrgLogo org={org} color={color} />
|
||||
<div className="flex items-start gap-3 sm:gap-4">
|
||||
<OrgLogo org={org} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3 className="text-xl font-bold leading-tight" style={{ color }}>
|
||||
<h3 className="text-lg sm:text-xl font-bold leading-tight [overflow-wrap:anywhere]" style={{ color }}>
|
||||
{org.name}
|
||||
</h3>
|
||||
{subtitle && (
|
||||
|
|
|
|||
|
|
@ -470,16 +470,16 @@ function RegionBlock({
|
|||
function GroupCard({ group, color, open, onOpen }) {
|
||||
return (
|
||||
<div
|
||||
className="p-4 flex items-start gap-4 transition-all duration-200"
|
||||
className="p-4 flex flex-wrap items-start gap-3 sm:gap-4 transition-all duration-200"
|
||||
style={{
|
||||
border: `1px solid ${color}`,
|
||||
background: open ? `color-mix(in srgb, ${color} 8%, var(--color-raised))` : "var(--color-raised)",
|
||||
}}
|
||||
>
|
||||
<OrgLogo org={group} color={color} />
|
||||
<OrgLogo org={group} color={color} size="h-10 w-10 sm:h-14 sm:w-14" />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="font-bold leading-tight">{group.name}</p>
|
||||
<div className="min-w-[8rem] flex-1">
|
||||
<p className="font-bold leading-tight [overflow-wrap:anywhere]">{group.name}</p>
|
||||
<p className="text-sm" style={{ color: FALLBACK_COLOR }}>
|
||||
{group.location_label}
|
||||
</p>
|
||||
|
|
@ -494,12 +494,12 @@ function GroupCard({ group, color, open, onOpen }) {
|
|||
detail panel in place, the arrow leaves for the group's
|
||||
own page. Keeping them distinct beats one control that
|
||||
does different things depending on where you click. */}
|
||||
<div className="shrink-0 flex items-center gap-2">
|
||||
<div className="ml-auto shrink-0 flex items-center gap-2">
|
||||
<button
|
||||
onClick={onOpen}
|
||||
aria-expanded={open}
|
||||
aria-label={`${open ? "Hide" : "View"} details for ${group.name}`}
|
||||
className="h-9 w-9 btn flex items-center justify-center transition-transform duration-200 hover:scale-110"
|
||||
className="h-10 w-10 btn flex items-center justify-center transition-transform duration-200 hover:scale-110"
|
||||
style={{
|
||||
border: `1px solid ${color}`,
|
||||
color,
|
||||
|
|
@ -540,21 +540,21 @@ function GroupDetail({ group, region, onClose }) {
|
|||
|
||||
return (
|
||||
<div
|
||||
className="p-6 mb-6"
|
||||
className="p-4 sm:p-6 mb-6"
|
||||
style={{ border: `2px solid ${colorOf(region)}`, background: `color-mix(in srgb, ${colorOf(region)} 6%, var(--color-raised))` }}
|
||||
>
|
||||
<div className="flex items-start gap-4">
|
||||
<OrgLogo org={group} color={colorOf(region)} size="h-20 w-20" />
|
||||
<OrgLogo org={group} color={colorOf(region)} size="h-12 w-12 sm:h-20 sm:w-20" />
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-2xl font-display font-bold leading-tight">{group.name}</p>
|
||||
<p className="text-xl sm:text-2xl font-display font-bold leading-tight [overflow-wrap:anywhere]">{group.name}</p>
|
||||
<p style={{ color: FALLBACK_COLOR }}>{group.location_label}</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
onClick={onClose}
|
||||
aria-label="Close details"
|
||||
className="shrink-0 h-8 w-8 btn flex items-center justify-center text-lg transition-transform duration-200 hover:scale-110"
|
||||
className="shrink-0 h-10 w-10 btn flex items-center justify-center text-lg transition-transform duration-200 hover:scale-110"
|
||||
style={{ border: `1px solid ${colorOf(region)}`, color: colorOf(region) }}
|
||||
>
|
||||
<X size={20} weight="bold" aria-hidden="true" />
|
||||
|
|
@ -844,13 +844,19 @@ export default function OrgListMap({ view = "map", accent = FALLBACK_COLOR }) {
|
|||
shell(
|
||||
<div className="grid grid-cols-1 lg:grid-cols-[1.45fr_1fr] gap-10 items-stretch">
|
||||
{/* Map */}
|
||||
<div>
|
||||
<RegionMap
|
||||
slices={slices}
|
||||
groupCounts={groupCounts}
|
||||
onPick={pickArea}
|
||||
{...shared}
|
||||
/>
|
||||
<div className="min-w-0">
|
||||
{/* On a phone the map keeps a readable size (tiles big enough
|
||||
to read and tap) and scrolls sideways in its own box. */}
|
||||
<div className="-mx-6 overflow-x-auto px-6 sm:mx-0 sm:px-0">
|
||||
<div className="min-w-[34rem] sm:min-w-0">
|
||||
<RegionMap
|
||||
slices={slices}
|
||||
groupCounts={groupCounts}
|
||||
onPick={pickArea}
|
||||
{...shared}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Legend
|
||||
domestic={domestic}
|
||||
international={international}
|
||||
|
|
|
|||
|
|
@ -544,6 +544,13 @@ a.site-tl__entry--featured:hover {
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
/* A touch screen has no hover to bring it up, so it reads in full. */
|
||||
@media (hover: none) {
|
||||
.site-tl__upcomingList {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes site-tl-rise {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
}}
|
||||
>
|
||||
{featured.map((item, index) => (
|
||||
<li key={item.id} className="w-[19rem] shrink-0 md:w-[22rem]">
|
||||
<li key={item.id} className="w-[min(19rem,80vw)] shrink-0 md:w-[22rem]">
|
||||
<RailCard
|
||||
item={item}
|
||||
showYear={index === 0 || year(item) !== year(featured[index - 1])}
|
||||
|
|
@ -149,7 +149,7 @@ export default function FeaturedTimelineRail({ id, title, blurb }: RailProps) {
|
|||
</li>
|
||||
))}
|
||||
|
||||
<li className="w-[19rem] shrink-0 md:w-[22rem]">
|
||||
<li className="w-[min(19rem,80vw)] shrink-0 md:w-[22rem]">
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="h-12" />
|
||||
<Link
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ export default function HeroStage({ hero }: { hero: Hero | null }) {
|
|||
return (
|
||||
<section
|
||||
id="hero"
|
||||
className="relative isolate flex min-h-[92dvh] items-center overflow-hidden pt-24 pb-16"
|
||||
className={`relative isolate flex min-h-[92dvh] items-center overflow-hidden pt-24 ${
|
||||
backdrop === 'photos' ? 'pb-36 sm:pb-28' : 'pb-16'
|
||||
}`}
|
||||
style={{ background: DEEP }}
|
||||
>
|
||||
{backdrop === 'photos' ? (
|
||||
|
|
@ -157,8 +159,8 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
|||
about two lines. */}
|
||||
<h1
|
||||
className={`hp-rise font-display font-bold leading-[1.02] tracking-tight ${
|
||||
beside ? 'text-4xl md:text-5xl' : 'text-5xl md:text-6xl lg:text-7xl'
|
||||
}`}
|
||||
beside ? 'text-4xl md:text-5xl' : 'text-4xl sm:text-5xl md:text-6xl lg:text-7xl'
|
||||
} [overflow-wrap:anywhere]`}
|
||||
style={{ animationDelay: '60ms' }}
|
||||
>
|
||||
{hero.headline}
|
||||
|
|
@ -186,12 +188,13 @@ function Words({ hero, feature }: { hero: Hero; feature: HeroFeature }) {
|
|||
Both set: one cell in two halves, the primary filled on the left
|
||||
and the secondary clear on the right, split by a slash (the
|
||||
filled half's slanted edge, which the clear half tucks under).
|
||||
One set: that one alone, in its own style. */
|
||||
On a phone the halves stack instead, filled on top, since two
|
||||
labels side by side don't fit; the slash starts at sm (home.css,
|
||||
.hp-split). One set: that one alone, in its own style. */
|
||||
|
||||
const SLANT = '1.75rem'
|
||||
const PRIMARY_FILL = '#f0bd4f'
|
||||
const PRIMARY_TEXT = '#001011'
|
||||
const HALF = 'relative flex items-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
|
||||
const HALF = 'relative flex items-center justify-center gap-2 px-8 py-4 text-lg transition-colors duration-200 focus-visible:outline-offset-[-6px]'
|
||||
|
||||
type HeroLink = Hero['primary']
|
||||
|
||||
|
|
@ -200,24 +203,15 @@ function HeroActions({ primary, secondary }: { primary: HeroLink; secondary: Her
|
|||
|
||||
if (primary && secondary) {
|
||||
return (
|
||||
<div className="btn inline-flex max-w-full overflow-hidden border border-white/35">
|
||||
<div className="hp-split btn max-w-full overflow-hidden border border-white/35">
|
||||
<HomeLink
|
||||
url={primary.url}
|
||||
className={`${HALF} z-10 hover:brightness-95`}
|
||||
style={{
|
||||
background: PRIMARY_FILL,
|
||||
color: PRIMARY_TEXT,
|
||||
paddingRight: `calc(2rem + ${SLANT})`,
|
||||
clipPath: `polygon(0 0, 100% 0, calc(100% - ${SLANT}) 100%, 0 100%)`,
|
||||
}}
|
||||
className={`hp-split__primary ${HALF} z-10 hover:brightness-95`}
|
||||
style={{ background: PRIMARY_FILL, color: PRIMARY_TEXT }}
|
||||
>
|
||||
{primary.label}
|
||||
</HomeLink>
|
||||
<HomeLink
|
||||
url={secondary.url}
|
||||
className={`${HALF} text-white hover:bg-white/10`}
|
||||
style={{ marginLeft: `-${SLANT}`, paddingLeft: `calc(2rem + ${SLANT})` }}
|
||||
>
|
||||
<HomeLink url={secondary.url} className={`hp-split__secondary ${HALF} text-white hover:bg-white/10`}>
|
||||
{secondary.label} {arrow}
|
||||
</HomeLink>
|
||||
</div>
|
||||
|
|
@ -323,8 +317,8 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
|||
)}
|
||||
|
||||
{slides.length > 1 && (
|
||||
<div className="ml-auto flex items-center gap-3">
|
||||
<div className="flex gap-1.5">
|
||||
<div className="ml-auto flex flex-wrap items-center justify-end gap-x-1 gap-y-0">
|
||||
<div className="flex flex-wrap justify-end">
|
||||
{slides.map((slide, i) => (
|
||||
<button
|
||||
key={`${slide.media}-${i}`}
|
||||
|
|
@ -332,15 +326,18 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
|||
onClick={() => setIndex(i)}
|
||||
aria-label={`Show photo ${i + 1} of ${slides.length}`}
|
||||
aria-current={i === index}
|
||||
className="h-1.5 w-10 overflow-hidden bg-white/25"
|
||||
// A 40px tap target around the thin bar it draws.
|
||||
className="flex h-10 w-11 items-center px-0.5"
|
||||
>
|
||||
<span
|
||||
// Re-keyed per index so the fill restarts on every change.
|
||||
key={`${index}-${i}`}
|
||||
className={`hp-progress block h-full bg-white ${
|
||||
i < index ? 'hp-progress--done' : i === index ? 'hp-progress--run' : ''
|
||||
} ${paused ? 'hp-progress--paused' : ''}`}
|
||||
/>
|
||||
<span className="block h-1.5 w-full overflow-hidden bg-white/25">
|
||||
<span
|
||||
// Re-keyed per index so the fill restarts on every change.
|
||||
key={`${index}-${i}`}
|
||||
className={`hp-progress block h-full bg-white ${
|
||||
i < index ? 'hp-progress--done' : i === index ? 'hp-progress--run' : ''
|
||||
} ${paused ? 'hp-progress--paused' : ''}`}
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
|
@ -348,7 +345,7 @@ function PhotoBackdrop({ slides, seconds }: { slides: HeroSlide[]; seconds: numb
|
|||
type="button"
|
||||
onClick={() => setPaused((p) => !p)}
|
||||
aria-label={paused ? 'Play slideshow' : 'Pause slideshow'}
|
||||
className="flex h-8 w-8 items-center justify-center btn border border-white/40 text-xs text-white hover:bg-white/10"
|
||||
className="ml-2 flex h-10 w-10 items-center justify-center btn border border-white/40 text-xs text-white hover:bg-white/10"
|
||||
>
|
||||
{paused ? <Play size={14} weight="fill" aria-hidden="true" /> : <Pause size={14} weight="fill" aria-hidden="true" />}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ export default function StatsBand({ id, title, blurb, stats }: StatsBandProps) {
|
|||
</h2>
|
||||
{blurb && <p className="mt-3 max-w-2xl text-white/70">{blurb}</p>}
|
||||
|
||||
<dl className="mt-12 grid grid-cols-2 gap-x-8 gap-y-14 md:grid-cols-4">
|
||||
<dl className="mt-12 grid grid-cols-2 gap-x-4 gap-y-14 sm:gap-x-8 md:grid-cols-4">
|
||||
{stats.map((stat, index) => (
|
||||
<div
|
||||
key={`${stat.label}-${index}`}
|
||||
className={`hp-stat border-l border-white/15 pl-6 ${seen ? 'hp-stat--in' : ''}`}
|
||||
className={`hp-stat border-l border-white/15 pl-4 sm:pl-6 ${seen ? 'hp-stat--in' : ''}`}
|
||||
style={{ transitionDelay: `${index * 120}ms` }}
|
||||
>
|
||||
<dd className="font-display text-5xl font-extrabold leading-none text-white md:text-6xl">
|
||||
<dd className="font-display text-4xl font-extrabold leading-none text-white sm:text-5xl md:text-6xl">
|
||||
<CountUp value={stat.value} run={seen} />
|
||||
{stat.suffix && <span className="text-[#f0bd4f]">{stat.suffix}</span>}
|
||||
</dd>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,32 @@
|
|||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
|
||||
/* ── Hero: the split button cell (HeroStage.tsx, HeroActions) ────
|
||||
Stacked on a phone; from sm, side by side and cut by a slash:
|
||||
the filled half's slanted right edge, the clear half tucked under
|
||||
it by the slant's width. */
|
||||
|
||||
.hp-split {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media (min-width: 40rem) {
|
||||
.hp-split {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
--hp-slant: 1.75rem;
|
||||
}
|
||||
.hp-split__primary {
|
||||
padding-right: calc(2rem + var(--hp-slant));
|
||||
clip-path: polygon(0 0, 100% 0, calc(100% - var(--hp-slant)) 100%, 0 100%);
|
||||
}
|
||||
.hp-split__secondary {
|
||||
margin-left: calc(var(--hp-slant) * -1);
|
||||
padding-left: calc(2rem + var(--hp-slant));
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Hero: photos ────────────────────────────────────────────── */
|
||||
|
||||
.hp-slide {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue