Align preview-card to architecture goals#180
Merged
Merged
Conversation
|
📚 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.
9bac32c to
1637cf1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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):
Depends — adjustable (consumer passes):
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>withtext-14 font-semibold text-primarybaked in viapreviewCardTitleVariantsPreviewCardDescription— renders a<p>withtext-13 text-secondarybaked in viapreviewCardDescriptionVariantsPreviewCardImage— renders an<img>withoverflow-hidden rounded-md object-coverbaked in viapreviewCardImageVariants; width/height remain the consumer's layout concernOther fixes
PreviewCardArrowwas unstyled (noclassNameat all, unlike every other arrow in the system). AddedpreviewCardArrowVariantswithtext-layer-1so the caret inherits the popup's surface colour.variants.tsonly — noclassNameorstyleprops on any component, nocxin component files.Stories
Both the ui-tier (
UI/PreviewCard) and components-tier (Components/PreviewCard) stories now usePreviewCardTitleandPreviewCardDescriptioninstead of raw spans. Both stories are registered insubcomponentsso Storybook autodocs shows the full anatomy.Notes