Add inline <code> support to Card, Rver and CTA banner components#1266
Add inline <code> support to Card, Rver and CTA banner components#1266
<code> support to Card, Rver and CTA banner components#1266Conversation
🦋 Changeset detectedLatest commit: fcbb0e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🟢 No design token changes found |
🟢 Unit test coverage changes foundUnit test coverage has been updated through this PR. Changes: 0 new tests, 0 removed tests, 0 improved, 1 decreased
|
|
<code> support to Card, Rver and CTA banner components
There was a problem hiding this comment.
Pull request overview
Adds support for inline <code> styling inside heading/description content for marketing components in @primer/react-brand, and documents the patterns via Storybook + visual regression snapshots.
Changes:
- Add component-scoped CSS rules for inline
<code>inCard,River, andCTABanner(font, background, padding, borders, and adjusted line-heights when code is present). - Update
Riverheading rendering to add an inner wrapper class to target:has(code)styling. - Add Storybook “kitchen sink” stories and Playwright visual regression tests/snapshots for inline code scenarios (including custom size overrides).
Reviewed changes
Copilot reviewed 12 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/river/river-shared.module.css.d.ts | Adds the new generated CSS module class key for River__heading-inner. |
| packages/react/src/river/river-shared.module.css | Adds inline <code> styling and conditional line-height adjustments for River headings/text. |
| packages/react/src/river/River/River.visual.spec.ts-snapshots/Visual-Comparison-River-River-With-Inline-Code-Element-Custom-Sizes-1-linux.png | Adds/updates River inline-code visual snapshot baseline. |
| packages/react/src/river/River/River.visual.spec.ts | Adds River visual regression coverage for inline-code stories. |
| packages/react/src/river/River/River.tsx | Adds River__heading-inner class to the heading element to enable conditional styling. |
| packages/react/src/river/River/River.features.stories.tsx | Adds River stories demonstrating inline <code> usage (including dark mode + custom sizes). |
| packages/react/src/Card/Card.visual.spec.ts-snapshots/Visual-Comparison-Card-Card-With-inline-code-element-non-standard-size-overrides-1-linux.png | Adds/updates Card inline-code visual snapshot baseline for size overrides. |
| packages/react/src/Card/Card.visual.spec.ts | Adds Card visual regression tests for inline-code stories. |
| packages/react/src/Card/Card.module.css | Adds inline <code> styling + conditional line-height adjustments for Card heading/description. |
| packages/react/src/Card/Card.features.stories.tsx | Adds Card stories demonstrating inline <code> across variants and size overrides. |
| packages/react/src/CTABanner/CTABanner.visual.spec.ts | Adds CTABanner visual regression coverage for inline-code story. |
| packages/react/src/CTABanner/CTABanner.tsx | Adds a backgroundColor-derived CSS class hook for inline code background overrides. |
| packages/react/src/CTABanner/CTABanner.module.css.d.ts | Adds the new generated CSS module class key for CTABanner--bgColor-default. |
| packages/react/src/CTABanner/CTABanner.module.css | Adds inline <code> styling + conditional line-height adjustments; adds bgColor-specific override. |
| packages/react/src/CTABanner/CTABanner.features.stories.tsx | Adds CTABanner stories demonstrating inline <code> across variants, backgrounds, and dark mode. |
| .changeset/sharp-kiwis-sneeze.md | Publishes a patch changeset describing the new inline <code> support. |
| @media screen and (min-width: 64rem) { | ||
| .River__heading-inner:has(code) { | ||
| line-height: calc(1lh * 2.1); | ||
| } | ||
| } |
There was a problem hiding this comment.
This media query uses min-width: 64rem, but the same file already documents the “Large breakpoint and up” as 63.25rem and the design token breakpoint.large is 1012px (63.25rem). To keep breakpoint behavior consistent, update this query to 63.25rem (or reference the same large breakpoint value used elsewhere in this file).
Dismissing to unblock the PR. Requested feedback has been actioned.


Summary
Adds support for
<code>elements inside the headings for Card, CtaBanner and River per this design.🔗 Cards preview
🔗 CTABanner preview
🔗 River preview
List of notable changes:
<code>, which inherits the parent font-sizeWhat should reviewers focus on?
Steps to test:
Supporting resources (related issues, external links, etc):
Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots: