Overhaul fixes: raised cards, balanced people rows, solid map, small button radius
- Cards sit on a raised surface (white, or a touch of tint in dark mode) with a shadow: featured cards, the connect block, people tiles. tint-soft is a faint teal again, not green. - Buttons: a small plain radius everywhere; no superellipse. - Video stills use YouTube's 16:9 frame (the 4:3 one cropped as a fallback), have small rounded corners, and show a round, centered play button on hover or focus (always on touch screens). - People tiles: rows balanced between 2 and 10 across, never ending on a lone tile where it can be helped. - Map tiles and region tags are solid, dimmed by color, not opacity. - Admin: white (surface) background, header and footer as wide as the content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
582c65077d
commit
a397f3eac0
12 changed files with 165 additions and 61 deletions
|
|
@ -112,7 +112,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
|
|||
|
||||
return (
|
||||
<li
|
||||
className={`relative flex flex-col overflow-hidden border-r-4 border-b-4 ${RULE} bg-surface transition-colors hover:bg-tint-soft ${
|
||||
className={`relative flex flex-col overflow-hidden border-r-4 border-b-4 ${RULE} bg-raised transition-colors hover:bg-tint-soft ${
|
||||
large ? 'lg:col-span-2 lg:row-span-2' : ''
|
||||
}`}
|
||||
>
|
||||
|
|
@ -134,7 +134,7 @@ function Card({ card, large }: { card: FeaturedCard; large: boolean }) {
|
|||
export default function FeaturedCards({ cards }: { cards: FeaturedCard[] }) {
|
||||
const leadLarge = cards.length >= 3
|
||||
return (
|
||||
<div className="overflow-hidden">
|
||||
<div className="overflow-hidden shadow-md">
|
||||
<ul className="-mr-[4px] -mb-[4px] grid sm:grid-cols-2 lg:grid-cols-3">
|
||||
{cards.map((card, index) => (
|
||||
<Card
|
||||
|
|
|
|||
|
|
@ -13,13 +13,14 @@
|
|||
|
||||
/* color */
|
||||
--pl-accent: var(--color-link);
|
||||
--pl-frame-bg: var(--color-surface);
|
||||
--pl-frame-bg: var(--color-raised);
|
||||
--pl-frame-edge: color-mix(in srgb, var(--color-brand) 45%, transparent);
|
||||
--pl-photo-bg: color-mix(in srgb, var(--color-muted) 15%, var(--color-surface));
|
||||
--pl-ink: var(--color-ink);
|
||||
--pl-muted: var(--color-muted);
|
||||
--pl-rule: color-mix(in srgb, var(--color-brand) 35%, transparent);
|
||||
|
||||
position: relative;
|
||||
container-type: inline-size;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
@ -93,6 +94,32 @@
|
|||
list-style: none;
|
||||
}
|
||||
|
||||
/* Balanced rows (PeopleTiles.tsx sets --pl-cols once it has measured):
|
||||
a grid of equal columns, each at most a tile wide, shrinking only
|
||||
when two won't fit. */
|
||||
.pl__row[style*="--pl-cols"] {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--pl-cols), minmax(0, var(--pl-w)));
|
||||
}
|
||||
|
||||
.pl[data-align="center"] .pl__row[style*="--pl-cols"] {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pl__row[style*="--pl-cols"] .pl__tile {
|
||||
width: 100%;
|
||||
max-width: var(--pl-w);
|
||||
}
|
||||
|
||||
/* Measures one tile's width and the gap for the balancing. */
|
||||
.pl__probe {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
width: var(--pl-w);
|
||||
height: var(--pl-gap);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.pl[data-overflow="scroll"] .pl__row {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
|
|
@ -142,6 +169,7 @@
|
|||
padding: var(--pl-pad);
|
||||
padding-bottom: calc(var(--pl-pad) * 1.6);
|
||||
background: var(--pl-frame-bg);
|
||||
box-shadow: var(--shadow-sm);
|
||||
transition: transform 160ms ease, background-color 160ms ease;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +360,6 @@
|
|||
height: 1.75rem;
|
||||
border: 1px solid var(--pl-frame-edge);
|
||||
border-radius: var(--btn-radius);
|
||||
corner-shape: squircle;
|
||||
background: var(--color-surface);
|
||||
color: var(--pl-muted);
|
||||
font-size: 1.1rem;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ import "./PeopleTiles.css";
|
|||
* lines of name (and two of title), so a row's cards are one
|
||||
* height. The list as a whole has the frame, not each tile.
|
||||
*
|
||||
* Rows are balanced (balancedColumns): as many tiles across as fit,
|
||||
* but never fewer than 2 or more than 10, and spread so the last
|
||||
* row isn't a lone tile. When 2 don't fit at full size they shrink.
|
||||
*
|
||||
* 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
|
||||
* the screen), and close on Escape, the tile again, or a click
|
||||
|
|
@ -413,6 +417,7 @@ export function PeopleTilesView({
|
|||
// the down arrow, and the details panel shows it whole.
|
||||
const [clipped, setClipped] = useState<ReadonlySet<string>>(() => new Set());
|
||||
const rootRef = useRef<HTMLDivElement>(null);
|
||||
const probeRef = useRef<HTMLSpanElement>(null);
|
||||
|
||||
const resolvedSize: PeopleTilesSize = SIZE_FEATURES[size] ? size : "md";
|
||||
const features = SIZE_FEATURES[resolvedSize];
|
||||
|
|
@ -433,6 +438,27 @@ export function PeopleTilesView({
|
|||
.filter((group) => group.people.length > 0);
|
||||
}, [groups, people]);
|
||||
|
||||
const hasPeople = resolvedGroups.length > 0;
|
||||
|
||||
// How much room a row has, and one tile's width and gap there, in
|
||||
// px: the probe carries --pl-w and --pl-gap, so the CSS stays the
|
||||
// one place that sizes tiles.
|
||||
const [room, setRoom] = useState<{ width: number; tile: number; gap: number } | null>(null);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const root = rootRef.current;
|
||||
const probe = probeRef.current;
|
||||
if (!root || !probe || overflow === "scroll") return undefined;
|
||||
const measure = () => {
|
||||
const padding = parseFloat(getComputedStyle(root).paddingLeft) * 2;
|
||||
setRoom({ width: root.clientWidth - padding, tile: probe.offsetWidth, gap: probe.offsetHeight });
|
||||
};
|
||||
measure();
|
||||
const observer = new ResizeObserver(measure);
|
||||
observer.observe(root);
|
||||
return () => observer.disconnect();
|
||||
}, [overflow, hasPeople]);
|
||||
|
||||
// A click anywhere outside the list closes the panel.
|
||||
useEffect(() => {
|
||||
if (!openKey) return undefined;
|
||||
|
|
@ -509,6 +535,7 @@ export function PeopleTilesView({
|
|||
onKeyDown={handleKeyDown}
|
||||
{...rest}
|
||||
>
|
||||
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
|
||||
<div className="pl__groups">
|
||||
{resolvedGroups.map((group) => (
|
||||
<section
|
||||
|
|
@ -526,7 +553,16 @@ export function PeopleTilesView({
|
|||
</header>
|
||||
)}
|
||||
|
||||
<ul className="pl__row">
|
||||
<ul
|
||||
className="pl__row"
|
||||
style={
|
||||
room
|
||||
? ({
|
||||
"--pl-cols": balancedColumns(group.people.length, room.width, room.tile, room.gap),
|
||||
} as CSSProperties)
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{group.people.map((person, index) => {
|
||||
const key = keyFor(group, person, index);
|
||||
const expandable = (features.details && hasDetails(person)) || clipped.has(key);
|
||||
|
|
@ -797,6 +833,19 @@ function Chevron() {
|
|||
|
||||
/* ── Helpers ─────────────────────────────────────────────────── */
|
||||
|
||||
/* Tiles across a row: as many as fit, at least 2 and at most 10
|
||||
(never more than there are), then evened out so the rows come
|
||||
out as close to equal as they can: 5 tiles that fit 4 across go
|
||||
3 and 2, not 4 and 1. If one tile would still be left alone (3
|
||||
where only 2 fit), one more, narrower, column takes it. */
|
||||
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 most = Math.min(count, 10, Math.max(2, fit));
|
||||
const cols = Math.ceil(count / Math.ceil(count / most));
|
||||
return count % cols === 1 && cols < Math.min(count, 10) ? cols + 1 : cols;
|
||||
}
|
||||
|
||||
/* A string id is a people slug; a numeric or missing one is a
|
||||
hand-written entry with no page behind it. */
|
||||
function profileHref(person: Person): string | null {
|
||||
|
|
|
|||
|
|
@ -5,14 +5,17 @@
|
|||
page loads no iframes until someone asks for one. Used by the
|
||||
featured cards and the video content block.
|
||||
|
||||
The still is the caller's image, else YouTube's own thumbnail,
|
||||
else a plain dark panel. A link that embeds.ts can't turn into a
|
||||
The still is the caller's image, else YouTube's own thumbnail
|
||||
(its 16:9 one, falling back to the 4:3 one cropped), else a plain
|
||||
dark panel. The play button shows on hover or keyboard focus, and
|
||||
always on a touch screen, which can't hover. Small rounded
|
||||
corners, as the only rounded thing besides buttons and dots. A link that embeds.ts can't turn into a
|
||||
player (not https, or not a host it knows how to frame) still
|
||||
goes somewhere: the still becomes a link to it.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { Play } from '@phosphor-icons/react'
|
||||
import { useState } from 'react'
|
||||
import { useState, type SyntheticEvent } from 'react'
|
||||
|
||||
import HomeLink from '../pages/sections/home/HomeLink.tsx'
|
||||
import { playingSource, videoSource, videoThumbnail } from '../lib/embeds.ts'
|
||||
|
|
@ -37,36 +40,42 @@ export default function VideoPlayer({
|
|||
if (playing && source) {
|
||||
const live = playingSource(source)
|
||||
return live.kind === 'file' ? (
|
||||
<video src={live.src} controls autoPlay playsInline className={`aspect-video w-full bg-black ${className}`} />
|
||||
<video src={live.src} controls autoPlay playsInline className={`aspect-video w-full rounded-md bg-black ${className}`} />
|
||||
) : (
|
||||
<iframe
|
||||
src={live.src}
|
||||
title={title || 'Video'}
|
||||
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
|
||||
allowFullScreen
|
||||
className={`aspect-video w-full border-0 bg-black ${className}`}
|
||||
className={`aspect-video w-full rounded-md border-0 bg-black ${className}`}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
const image = still ?? videoThumbnail(url)
|
||||
|
||||
// YouTube's 16:9 still is missing for some videos; its 4:3 one never is.
|
||||
const fallBack = (event: SyntheticEvent<HTMLImageElement>) => {
|
||||
const img = event.currentTarget
|
||||
if (img.src.endsWith('/hq720.jpg')) img.src = img.src.replace(/hq720\.jpg$/, 'hqdefault.jpg')
|
||||
}
|
||||
|
||||
const face = (
|
||||
<>
|
||||
<span className={`relative block overflow-hidden rounded-md ${className}`}>
|
||||
{image ? (
|
||||
<img src={image} alt="" loading="lazy" className={`aspect-video w-full object-cover ${className}`} />
|
||||
<img src={image} alt="" loading="lazy" onError={fallBack} className="block aspect-video w-full object-cover" />
|
||||
) : (
|
||||
<div className={`aspect-video w-full bg-[#004552] ${className}`} />
|
||||
<span className="block aspect-video w-full bg-[#004552]" />
|
||||
)}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="absolute inset-0 flex items-center justify-center bg-black/10 transition-colors group-hover:bg-black/25"
|
||||
className="video-play absolute inset-0 flex items-center justify-center transition-colors group-hover:bg-black/20 group-focus-visible:bg-black/20"
|
||||
>
|
||||
<span className="flex h-16 w-16 items-center justify-center btn bg-white/90 shadow-lg transition-transform group-hover:scale-110">
|
||||
<Play className="ml-1 h-7 w-7" weight="fill" style={{ color: BRAND }} aria-hidden="true" />
|
||||
<span className="flex h-16 w-16 items-center justify-center rounded-full bg-white/95 shadow-lg transition-transform group-hover:scale-105">
|
||||
<Play className="h-7 w-7" weight="fill" style={{ color: BRAND }} aria-hidden="true" />
|
||||
</span>
|
||||
</span>
|
||||
</>
|
||||
</span>
|
||||
)
|
||||
|
||||
if (!source) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue