Skip to content

Improve news card image framing and text alignment#987

Open
RisingOrange wants to merge 5 commits into
PauseAI:mainfrom
RisingOrange:news-card-images
Open

Improve news card image framing and text alignment#987
RisingOrange wants to merge 5 commits into
PauseAI:mainfrom
RisingOrange:news-card-images

Conversation

@RisingOrange

@RisingOrange RisingOrange commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Two related improvements to the news cards: images are no longer cropped, and card text now lines up across a row.

Image framing

The cards previously used aspect-ratio: 16/10 with object-fit: cover for every image, which cropped the edges of anything that wasn't already a matching landscape shape — posters, charts, and Substack banners lost content.

Following the existing post-banner design system (#702), which standardizes internal post images to a curated 1200/628 crop:

  • Card frame now uses aspect-ratio: 1200 / 628 to match the post banner ratio.
  • Internal post images keep object-fit: cover — they're curated to frame well at this ratio. Their Image aspectRatio hint is updated to 1200/628 so the responsive sizes math stays accurate.
  • Substack/press images (arbitrary shapes we don't control) use object-fit: contain so charts, posters, and wide/tall banners show in full instead of being cropped.
  • The image container gets a --bg-subtle background so the contained letterbox blends with the card body.
  • Hover zoom (scale(1.03)) is scoped to cover-cropped images only — zooming a contained image would re-crop it under overflow: hidden.

Text alignment

Titles range from one to three lines, so the description below each started at a different height across a row, and short titles left an awkward gap above their description (reported on Discord).

  • The title now reserves a fixed two-line area and is vertically centered within it, so descriptions line up regardless of title length and short one-line titles no longer leave a gap. The 2-line clamp lives on an inner span because -webkit-line-clamp needs display: -webkit-box, which can't coexist with the flex centering.
  • Dates already align (pinned to the bottom of equal-height cards).

Before / After

Rendered with the real production news images and copy. Note in before: the wide Fable 5 banner / chart / tall portraits are cropped, and the row-1 descriptions ("Apply now" / "Hundreds of…" / "The US reaction…") sit at different heights. In after: images show in full and descriptions line up.

Before:

Before

After:

After

Verification

  • pnpm check — 0 errors; pnpm _lint:knip — passes; eslint clean
  • Before/after rendered via headless Chrome using live prod images; confirmed object-fit: contain resolves correctly for external images inside NetlifyImage's <picture> wrapper, and the fixed-height centered title aligns descriptions.

Match the card image frame to the 1200/628 post-banner crop and switch
image fit by source: internal post images (curated to frame well at that
ratio) keep object-fit: cover, while Substack/press images (arbitrary
shapes we don't control) use object-fit: contain so charts, posters and
banners aren't cropped. The container gets a bg-subtle background so the
contained letterbox blends with the card.
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

👷 Deploy request for pauseai pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ad3c0aa

The hover scale(1.03) was applied to all card images; for contained
(external) images the container's overflow:hidden then clips the enlarged
image, cutting off ~1.5% on hover and defeating the point of contain.
Scope the zoom to cover-cropped internal images only.
Resolve NewsCard.svelte image conflict: combine the source-based object-fit
(cover internal / contain external) with main's new Image aspectRatio prop,
updating it to 1200/628 to match the new card image frame.
RisingOrange added a commit to RisingOrange/pauseai-website that referenced this pull request Jul 18, 2026
@RisingOrange
RisingOrange marked this pull request as ready for review July 18, 2026 12:52
@RisingOrange
RisingOrange marked this pull request as draft July 18, 2026 13:12
Titles vary from one to three lines, so subtitles started at different
heights across a row. Reserve a fixed two-line title area and vertically
center the title within it: subtitles now line up regardless of title
length, and short one-line titles no longer leave a gap above the
subtitle. The line clamp moves to an inner span because -webkit-line-clamp
needs display:-webkit-box, which can't coexist with the flex centering.
@RisingOrange RisingOrange changed the title Show news card images without cutting them off Improve news card image framing and text alignment Jul 18, 2026
RisingOrange added a commit to RisingOrange/pauseai-website that referenced this pull request Jul 18, 2026
The fixed-height title area uses display:flex; making it column so the
two loading skeleton bars stack on separate lines again instead of
shrinking side-by-side, while keeping the loaded single-line/two-line
title vertically centered.
@RisingOrange
RisingOrange marked this pull request as ready for review July 18, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant