Skip to content

Align preview-card to architecture goals#180

Merged
lifeiscontent merged 4 commits into
mainfrom
align/preview-card
Jun 24, 2026
Merged

Align preview-card to architecture goals#180
lifeiscontent merged 4 commits into
mainfrom
align/preview-card

Conversation

@lifeiscontent

Copy link
Copy Markdown
Collaborator

Closes #144

What the designer's spec says

From the issue comment, the spec divides the card's properties into two buckets:

Always the same (baked in, no consumer choice):

  • Border-radius on the card surface
  • Image/thumbnail: overflow hidden, object-cover fill
  • Content layout: image above text, text area padded
  • Title and description font styles and hierarchy
  • Arrow/caret inherits the card background

Depends — adjustable (consumer passes):

  • Image source, title text, description text
  • Metadata (date, author, tags)
  • Link/action target
  • Size/layout variant
  • Whether the card is clickable

What changed

Before this PR the popup body in both tier stories was raw <span className="text-14 font-semibold text-primary"> elements — styled inline rather than via named anatomy parts. The "always the same" items from the spec had no enforcement point.

New anatomy parts (propel extensions — no Base UI counterpart)

  • PreviewCardTitle — renders a <p> with text-14 font-semibold text-primary baked in via previewCardTitleVariants
  • PreviewCardDescription — renders a <p> with text-13 text-secondary baked in via previewCardDescriptionVariants
  • PreviewCardImage — renders an <img> with overflow-hidden rounded-md object-cover baked in via previewCardImageVariants; width/height remain the consumer's layout concern

Other fixes

  • PreviewCardArrow was unstyled (no className at all, unlike every other arrow in the system). Added previewCardArrowVariants with text-layer-1 so the caret inherits the popup's surface colour.
  • All new variants live in variants.ts only — no className or style props on any component, no cx in component files.

Stories

Both the ui-tier (UI/PreviewCard) and components-tier (Components/PreviewCard) stories now use PreviewCardTitle and PreviewCardDescription instead of raw spans. Both stories are registered in subcomponents so Storybook autodocs shows the full anatomy.

Notes

  • Needs design approval from @bhaveshraja before merging.
  • The "size/layout variant" axis from the spec is listed as adjustable but no Figma designs have been provided for the specific variant values, so that axis is not added here to avoid speculation.

@github-actions

Copy link
Copy Markdown

📚 Storybook preview: https://pr-180-propel-storybook.vamsi-906.workers.dev

Adds PreviewCardTitle, PreviewCardDescription, and PreviewCardImage as
propel-extended anatomy parts (Base UI has no counterparts for these).
Their styles encode the "always the same" items from the designer's spec
— title/description font hierarchy and image overflow-hidden/object-cover
— so consumers use the parts rather than hand-rolling raw spans with
inline classNames.

Also adds previewCardArrowVariants (text-layer-1) so the caret inherits
the popup surface background, matching every other arrow in the system.

Both tier stories are updated to use the new named parts.
The text content area of a preview card is its own anatomy region: per the
design spec the content layout (title above description) and the padding
around it are always the same. Previously each composition hand-rolled a
`<div className="flex flex-col gap-1">` for it and the popup baked the padding,
so a full-bleed image could not sit edge-to-edge above the text.

Add `PreviewCardBody` (single element, `flex flex-col gap-1 p-3` in cva), move
the padding off the popup onto the body, and let the image round/clip itself so
the popup needs no overflow-hidden (which would clip the arrow). Both stories now
compose Body and register it in subcomponents.
@lifeiscontent lifeiscontent merged commit 190e1a2 into main Jun 24, 2026
2 checks passed
@lifeiscontent lifeiscontent deleted the align/preview-card branch June 24, 2026 10:40
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.

Preview card: what should always look the same, and what should be adjustable?

1 participant