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
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue