feat(card): align component with fusion design system - FE-7266 - #8073
feat(card): align component with fusion design system - FE-7266#8073DipperTheDan wants to merge 9 commits into
Conversation
| } | ||
|
|
||
| const paddingSizes = { | ||
| none: "var(--spacing000)", |
There was a problem hiding this comment.
I have used the old DS tokens here to conform with the other spacing values in the declaration. This component is being deprecated too.
a315f35 to
6458f6b
Compare
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Aligns the Card component implementation, styles, stories, and tests with the Fusion Design System by moving to new spacing/radius/depth tokens, introducing new API surface (cardType, header, draggableAccessory), and deprecating legacy subcomponents/props.
Changes:
- Updated Card styling to use Fusion tokens (new spacing options, new roundness tokens/aliases, new depth tokens, updated content border-radius behavior with header/footer).
- Added/updated APIs and examples (
cardType,header,draggableAccessory, draggable layout row), and deprecated legacy pieces (CardRow,CardColumn,CardFootervariant, custom boxShadow props). - Refreshed Storybook stories/MDX docs and unit/Playwright tests to match the new design + behavior.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/card/components.test-pw.tsx | Updated Playwright component examples to new Card composition patterns (Box + Typography, new Button import). |
| src/components/card/card.test.tsx | Updated and expanded unit tests for new roundness tokens, draggable accessory, cardType shadows, extra-small spacing behavior. |
| src/components/card/card.style.ts | Migrated Card styling to Fusion tokens; added header-aware border radius logic and a draggable row style. |
| src/components/card/card.stories.tsx | Reworked stories to match new layout and tokens; added new stories (without footer, spacing variants, draggable). |
| src/components/card/card.mdx | Updated docs to reference new/added stories and updated roundness/draggable documentation. |
| src/components/card/card.config.ts | Expanded allowed spacing values to include none and extra-small. |
| src/components/card/card.component.tsx | Added cardType, header, draggableAccessory; updated defaults and draggable rendering structure. |
| src/components/card/card-test.stories.tsx | Updated test stories and added focused-state stories for Chromatic coverage. |
| src/components/card/card-row/card-row.test.tsx | Updated strict-context error message expectation. |
| src/components/card/card-row/card-row.style.ts | Added support for none and extra-small spacing. |
| src/components/card/card-row/card-row.component.tsx | Marked CardRow as deprecated. |
| src/components/card/card-footer/card-footer.test.tsx | Updated strict-context error message expectation and roundness expectations. |
| src/components/card/card-footer/card-footer.style.ts | Updated margin sizing and border-radius tokens to Fusion equivalents. |
| src/components/card/card-footer/card-footer.component.tsx | Marked variant prop as deprecated. |
| src/components/card/card-column/card-column.component.tsx | Marked CardColumn as deprecated. |
| src/components/card/internal/card.context.ts | Updated roundness type/default and strict-context error message. |
| skills/carbon-react/index.md | Content excluded by policy; not reviewed. |
| skills/carbon-react/components/card.md | Content excluded by policy; not reviewed. |
| skills/carbon-react/components/card-row.md | Content excluded by policy; not reviewed. |
| skills/carbon-react/components/card-footer.md | Content excluded by policy; not reviewed. |
| skills/carbon-react/components/card-column.md | Content excluded by policy; not reviewed. |
Files excluded by content exclusion policy (5)
- skills/carbon-react/components/card-column.md
- skills/carbon-react/components/card-footer.md
- skills/carbon-react/components/card-row.md
- skills/carbon-react/components/card.md
- skills/carbon-react/index.md
| expect(cardFooterElement).toHaveStyleRule( | ||
| "border-bottom-left-radius", | ||
| `var(--borderRadius${roundness === "default" ? "1" : "2"}00)`, | ||
| roundness === "moderate" |
There was a problem hiding this comment.
suggestion: I'd add these respective values into the .each test params as we should really avoid conditions like these in tests
edleeks87
left a comment
There was a problem hiding this comment.
Nice work @DipperTheDan out of interest do we know if the deprecated sub-components still work with the updates? Might be worth adding something so we know we aren't about to break everything for everyone
| rel, | ||
| target, | ||
| "aria-label": ariaLabel, | ||
| cardType = "standard", |
There was a problem hiding this comment.
suggestion: we could use variant here so we're consistent with how we've done this type of thing in other components
|
|
||
| ${({ roundness, hasFooter }) => css` | ||
| ${roundness === "default" && | ||
| ${({ roundness, $hasHeader, $hasFooter }) => css` |
There was a problem hiding this comment.
| ${({ roundness, $hasHeader, $hasFooter }) => css` | |
| ${({ $roundness, $hasHeader, $hasFooter }) => css` |
Nice one for making the others non-transitive
Yeah, the old |
|
@DipperTheDan I've reviewed your build and these are the elements i found that need actioning:
|
530e671 to
ca45e7e
Compare
|
|
||
| ${({ roundness, hasFooter }) => css` | ||
| ${roundness === "default" && | ||
| ${({ roundness, $hasHeader, $hasFooter }) => css` |
| ``` | ||
|
|
||
|
|
||
| ### Playground |
There was a problem hiding this comment.
comment: we should remove these from the skills files as they're not much use if you can't interact with them etc. Happy for it to be done as separate ticket if you don't mind raising it
Proposed behaviour
Align component with Fusion Design System.
Current behaviour
Component is out of date with the latest Fusion Design System.
Checklist
d.tsfile added or updated if requiredQA
Additional context
N/A
Testing instructions
Component should match designs and specs provided in the ticket.