UI Card: full bleed as header hero image & content cover#77856
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
d0819e2 to
d72f28b
Compare
|
Size Change: +290 B (0%) Total Size: 7.97 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Makes sense to me. Nice change :) |
d72f28b to
df2abb3
Compare
|
Flaky tests detected in b34df23. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26028451010
|
mirka
left a comment
There was a problem hiding this comment.
As I understand it, Header and Content are both just non-semantic containers with padding. So there's no reason to put your image in those containers if it doesn't suit your desired layout.
Of the new cases listed, on first glance there seem to be existing solutions without even using FullBleed:
- As the first child of
Card.Header→ Place the image outside theHeader, directly insideRoot. - As the sole child of
Card.Content→ OmitContentand just place the image directly insideRoot.
If this is true, should these just be documented as patterns in the Storybook examples, rather than adding new styles? The added styles do add a good amount of complexity and testing surface, so ideally we just improve the documentation if valid solutions already exist.
df2abb3 to
24d7858
Compare
|
@mirka nice! Even simpler. I documented the cases in Storybook. I also fixed the missing gap between Good for another look now! |
|
@mirka I see your point about leaner (and pre-existing) solutions for some of these layouts, but I'm wondering if the approach proposed initially (ie. using In other words, I think that, in terms of API clarity and consistency, I'd prefer to give consumers more predictability around how to put a Also, the previous approach allows for more consistent spacing (ensured by Card's internal spacing between Header and Content) |
The Maybe for content images we support all full bleed placement in |
|
I think it would be better for the image (and all visible "content") to be inside Also, from the PoV of the consumer, I think I'd be a bit confused as to why I wouldn't always use |
|
Ok, if that's a conscious choice I think that's fine 👍 |
|
@simison , in the light of the conversation above, could you revert to the original approach tried in this PR? Excuses for the back-and-forth 🙇 |
4e6bf90 to
da3202d
Compare
|
Sure! Rebased + updated to previous state. Left the previous experiment in PR commits so it's easy to recover/play around with if needed. Also reverted PR description/title with screenshots. |
|
Forgot to mention — let's also test how the |
…first child" This reverts commit 7998d69.
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
Composes `Card.Header` / `Card.Content` (and `CollapsibleCard.Content`) as a `Stack` via the `render` prop, so FullBleed stays a direct child of `.header` / `.content` (top/bottom-edge bleed selectors keep firing) while `Stack`'s `gap` handles the space between FullBleed and its siblings — no extra DOM wrapper.
The `.header > .fullbleed:first-child:not(:last-child)` rule fired
only when FullBleed was the first child of `Header` and was followed
by another sibling — a Header-only, one-direction special case that
muddled the contract around who owns inter-sibling spacing.
With the Storybook stories switched to `render={ <Stack /> }`, the
hero+title pattern is handled at the consumer layer via Stack's
`gap`, so the bespoke rule is no longer needed.
A previous rewrite of the Content paragraph accidentally clipped the
Header-first-child bullet, even though the CSS rule and CHANGELOG
both still describe the behavior. Restore the bullet, dedupe the
duplicated `CollapsibleCard` caveat, and call out the
`render={ <Stack /> }` composition pattern for adding inter-sibling
spacing without losing the edge-bleed.
Split the ambiguous "Only" stories into a clearer "Cover" vs. "Hero" axis based on where FullBleed lives in the card: - `FullBleedOnly` → `FullBleedCoverOnly` - `FullBleedContentWithHeader` → `FullBleedCoverWithHeader` - `FullBleedInHeader` → `FullBleedHeroWithTitle` `WithFullBleed` (showcase) and `FullBleedHeroOnly` keep their names. `CollapsibleCard`'s equivalent story is renamed for parity.
- `CollapsibleCard.FullBleedCoverWithHeader` JSDoc referenced the now-renamed `FullBleedOnly` story. - `CHANGELOG` still described "siblings retain normal padding" for the hero-in-header case, which no longer holds after dropping the asymmetric gap rule. Updated to match the new consumer-managed spacing contract (compose with `Stack` via `render`).
The release tooling swept this PR's entry into the 0.13.0 section when 0.13.0 was published mid-review. Move it back under the Unreleased heading so it lands in the next release.
e26385c to
b34df23
Compare
|
@simison I tested some changes locally and they seemed to work for me, and so I pushed them to this branch (togehter with updating the CHANGELOG after rebasing) |
|
Nice use of |
What?
Adds "full bleed" hero image header and hero image cover by allowing the container to bump against the top or bottom borders.
Why?
Hero images in cards are a common pattern, e.g.:
Full cover images within card containers are also common.
How?
Card:Card.FullBleednow supports edge-bumping in additional positions:Card.Header, it extends flush to the card's top and side edges — ideal for hero images. Inter-sibling spacing is consumer-managed: composeCard.HeaderwithStackvia therenderprop to add a gap between the hero and following siblings (e.g.Card.Title).Card.Content, it extends flush to the card's side edges and additionally to the top edge whenContentis the first card child, or the bottom edge when it is the last. This enables full-bleed content panels with or without a header above them.Usage
Hero image with header title and with content
Just the image as header with content
Just the image as content
Header + just the image as content
Testing Instructions
See storybook examples:
npm run storybook:devTesting Instructions for Keyboard
Screenshots or screencast
Before, without these changes, there was always top-margin and no ability to combine header title with full bleed:
Use of AI Tools