ui: widen a card's track by 25%

`CardGroup`'s default `minWidth` goes from 200 to 250, and the one call site that names its
own -- the map's search results -- from 220 to 275, keeping the 10% it sits above the default.

A card wall read too dense: at a 1280px window the grid ran five cards to a row where the
pre-migration Semantic build ran four, and a video title had about two words per line.  At 250
it runs four cards of 300px, which is what Semantic measured at that width (four cards, 290px
each) -- so this lands on the old layout rather than near it.

Raising the default rather than each page is the point of it being a default: videos, archives,
docs, files and the gallery all take it.

Measured across the range, and no width regresses:

    grid width   cards/row   card width   poster side gap
    430              1          430             0
    570              2          277             0
    600              2          292             0
    900              3          290             0
    1245             4          300             0
    1600             5          308             0

A phone is unaffected -- one column below about 570px of content width either way -- and the
poster still fills the card at every width, since its cap is a fraction of the card rather than
a fixed height.

Verified: 1143 jest tests / 65 suites, clean build, screenshotted at 1280px.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-08-03 19:50:18 -06:00
parent 9e35d56bc4
commit 8a1233c663
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 26 additions and 5 deletions

View file

@ -119,7 +119,7 @@ export function MapSearchView() {
}
return <React.Fragment>
<CardGroup minWidth={220}>
<CardGroup minWidth={275}>
{results.map((place, i) =>
<MapPlaceCard key={`${place.name}-${place.lat}-${place.lon}-${i}`} place={place} index={i}/>
)}

View file

@ -207,14 +207,19 @@ export function Card({media, title, meta, children, actions, onClick, color, cla
export interface CardGroupProps extends React.HTMLAttributes<HTMLDivElement> {
/**
* The narrowest a card may be laid out. `auto-fill` rather than `auto-fit`, so a group
* of two cards in a wide column keeps them card-sized instead of stretching each to half
* the page.
* The narrowest a card may be laid out, in px at the unscaled design size. `auto-fill`
* rather than `auto-fit`, so a group of two cards in a wide column keeps them card-sized
* instead of stretching each to half the page.
*
* The default was 200 and is 250: a card wall read too dense, running five to a row at
* 1280px where the pre-migration build ran four, which left a video title about two words
* wide. Raising the default rather than each page is the point of it being a default --
* videos, archives, docs, files and the gallery all take it.
*/
minWidth?: number;
}
export function CardGroup({children, minWidth = 200, className, style, ...props}: CardGroupProps) {
export function CardGroup({children, minWidth = 250, className, style, ...props}: CardGroupProps) {
return <div
className={['wrolpi-card-group', className].filter(Boolean).join(' ')}
style={{

View file

@ -946,6 +946,22 @@ describe('CardGroup', () => {
expect(screen.getByText('Three')).toBeInTheDocument();
});
it('gives a card 250px of track by default', () => {
/*
* Was 200. Raised 25% because a card wall was reading too dense: at 1280px the grid
* ran five cards to a row where the pre-migration build ran four, and a video title
* had about two words per line. It is the default rather than a per-page choice
* because every card wall in the app -- videos, archives, docs, files, the gallery --
* takes it, which is the point of it being a default.
*
* A phone is unaffected: one column below about 570px of content width either way.
*/
const {container} = renderUI(<CardGroup><Card title='One'/></CardGroup>);
expect(container.querySelector('.wrolpi-card-group'))
.toHaveStyle({gridTemplateColumns: 'repeat(auto-fill, minmax(15.625rem, 1fr))'});
});
it('lays cards out on a track no narrower than minWidth, in rem so it scales', () => {
/*
* The default suits file results; a group of wide cards raises it. If the value were