Region featured cards, featured grid, video stills, media naming (v1.13.2-region-cards) #30

Merged
ngu-git-admin merged 6 commits from region-featured-cards into main 2026-10-16 20:13:17 +01:00
2 changed files with 43 additions and 2 deletions
Showing only changes of commit 910aef78b5 - Show all commits

View file

@ -630,6 +630,16 @@ iframe[src*="churchcenter"] {
transition: transform 200ms ease; transition: transform 200ms ease;
} }
/* A closed region row's featured cards: the top of them, fading out
into whatever is behind (a mask, not a painted gradient, so it
works over the page backdrop in both modes). */
.ol-peek {
max-height: 9rem;
overflow: hidden;
opacity: 0.85;
mask-image: linear-gradient(to bottom, black 20%, transparent);
}
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
.ol-panel, .ol-panel,
.ol-chevron { .ol-chevron {

View file

@ -1,5 +1,5 @@
import { ArrowUpRight, CaretRight } from '@phosphor-icons/react'; import { ArrowUpRight, CaretDown, CaretRight } from '@phosphor-icons/react';
import { useId, useState } from "react"; import { useId, useRef, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import ArrowLink from "../../components/ArrowLink.tsx"; import ArrowLink from "../../components/ArrowLink.tsx";
import FeaturedCards from "../../components/FeaturedCards.tsx"; import FeaturedCards from "../../components/FeaturedCards.tsx";
@ -84,6 +84,7 @@ function OrgMark({ org, color }) {
function OrgRow({ org, pageLabel, siteLabel, titled }) { function OrgRow({ org, pageLabel, siteLabel, titled }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const panelId = useId(); const panelId = useId();
const toggleRef = useRef<HTMLButtonElement>(null);
const reading = useReadingMode(); const reading = useReadingMode();
// Under a block title the names are a level below it. // Under a block title the names are a level below it.
const Name = titled ? "h4" : "h3"; const Name = titled ? "h4" : "h3";
@ -120,6 +121,7 @@ function OrgRow({ org, pageLabel, siteLabel, titled }) {
</div> </div>
) : ( ) : (
<button <button
ref={toggleRef}
onClick={() => setOpen(v => !v)} onClick={() => setOpen(v => !v)}
aria-expanded={open} aria-expanded={open}
aria-controls={panelId} aria-controls={panelId}
@ -167,6 +169,35 @@ function OrgRow({ org, pageLabel, siteLabel, titled }) {
</div> </div>
</div> </div>
{/* Closed, a region with featured cards shows their top half
fading out, and a button that opens the row to them. The
peek is a picture of the cards, not a second set of links:
inert, so it takes no clicks or tab stops, and hidden from
screen readers, which get the button. */}
{featured.length > 0 && !open && !reading && (
<div className="pl-10 pr-2 pt-2">
<div className="ol-peek" inert aria-hidden="true">
<FeaturedCards cards={featured} level={titled ? 5 : 4} />
</div>
<button
type="button"
// The button goes as the row opens, so focus moves to the
// row's own toggle rather than falling back to the page.
onClick={() => {
setOpen(true);
toggleRef.current?.focus();
}}
aria-controls={panelId}
aria-expanded={false}
className="btn -mt-4 relative inline-flex items-center gap-2 py-2 px-4 text-sm"
style={{ border: `1px solid ${color}`, color: accentText(color) }}
>
Show featured ({featured.length})
<CaretDown size="1em" weight="bold" aria-hidden="true" />
</button>
</div>
)}
{/* 0fr → 1fr animates to the panel's real height, so nobody {/* 0fr → 1fr animates to the panel's real height, so nobody
has to guess a max-height that's wrong the moment a has to guess a max-height that's wrong the moment a
description grows. */} description grows. */}