-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5747] feat: Card - update styles, deprecate clickability #3318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 438ddea The changes in this PR will be included in the next version bump. This PR includes changesets to release 87 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 |
|
Size Change: +1.61 kB (+0.09%) Total Size: 1.79 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR modernizes the Card component by simplifying its visual appearance and deprecating root-level clickability. The changes align with design system evolution toward cleaner, more focused component responsibilities.
Key changes:
- Updated border color from
gray.light2togray.light1for a subtler appearance - Removed base box shadows from both light and dark themes
- Deprecated
ContentStyleenum,contentStyleprop,onClick, andhrefwith JSDoc annotations
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/card/src/Card/types.ts | Added deprecation JSDoc comments to ContentStyle enum, contentStyle prop, and newly documented onClick/href props |
| packages/card/src/Card/styles.ts | Updated light theme border color, removed base box shadows, refactored styling logic into getCardStyles helper, and changed focus ring styles |
| packages/card/src/Card/Card.tsx | Simplified className generation by using the new getCardStyles helper function |
| packages/card/src/Card.stories.tsx | Removed deprecated ContentStyle import and related Storybook configuration |
| .changeset/vast-facts-press.md | Added changeset documenting the deprecation and style updates |
Comments suppressed due to low confidence (1)
packages/card/src/Card/styles.ts:71
- The focus box shadow should include the focus ring. Currently this only shows
${darkBaseBoxShadow}, but it should bebox-shadow: ${darkFocusBoxShadow}, ${darkBaseBoxShadow};to display the focus ring when the card is focused during hover/active states in dark theme.
box-shadow: ${darkBaseBoxShadow}, ${darkFocusBoxShadow};
.changeset/vast-facts-press.md
Outdated
| '@leafygreen-ui/card': minor | ||
| --- | ||
|
|
||
| deprecated clickable stlying and functionality, updated styles (removed shadows and added border) |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the changeset description: "stlying" should be "styling".
| deprecated clickable stlying and functionality, updated styles (removed shadows and added border) | |
| deprecated clickable styling and functionality, updated styles (removed shadows and added border) |
.changeset/vast-facts-press.md
Outdated
| '@leafygreen-ui/card': minor | ||
| --- | ||
|
|
||
| deprecated clickable stlying and functionality, updated styles (removed shadows and added border) |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changeset description mentions "added border" but the changes actually update an existing border color from gray.light2 to gray.light1, not adding a new border. Consider revising to: "deprecated clickable styling and functionality, updated styles (removed shadows and updated border color)".
| deprecated clickable stlying and functionality, updated styles (removed shadows and added border) | |
| deprecated clickable styling and functionality, updated styles (removed shadows and updated border color) |
packages/card/src/Card/Card.tsx
Outdated
| }, | ||
| className, | ||
| )} | ||
| className={cx(getCardStyles({ theme, contentStyle, className }))} |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cx() call is redundant here since getCardStyles() already returns a result from cx(). You can simplify this to just className={getCardStyles({ theme, contentStyle, className })} without the outer cx() wrapper.
| className={cx(getCardStyles({ theme, contentStyle, className }))} | |
| className={getCardStyles({ theme, contentStyle, className })} |
| } from '@leafygreen-ui/polymorphic'; | ||
|
|
||
| /** | ||
| * @deprecated No longer supported. We don't want card to be clickable from a root level. |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecation message should specify what developers should use instead. Consider adding guidance like: "@deprecated No longer supported. We don't want card to be clickable from a root level. If you need clickable behavior, wrap interactive elements inside the Card instead."
| * Click handler for the Card component. | ||
| * | ||
| * @deprecated No longer supported. We don't want card to be clickable from a root level. | ||
| */ | ||
| onClick?: React.MouseEventHandler<any>; |
Copilot
AI
Nov 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc comment for the onClick handler is missing a description of what the parameter type is. Consider updating to: "Click handler for the Card component. Receives a MouseEvent." Also, using React.MouseEventHandler<any> with any is not type-safe - consider specifying the actual element type (e.g., HTMLDivElement) instead of any.
| * Click handler for the Card component. | |
| * | |
| * @deprecated No longer supported. We don't want card to be clickable from a root level. | |
| */ | |
| onClick?: React.MouseEventHandler<any>; | |
| * Click handler for the Card component. Receives a MouseEvent. | |
| * | |
| * @param event - The mouse event triggered by clicking the Card. | |
| * @deprecated No longer supported. We don't want card to be clickable from a root level. | |
| */ | |
| onClick?: React.MouseEventHandler<HTMLDivElement>; |
|
Coverage after merging ar/LG-5747-card-border into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
✍️ Proposed changes
This PR updates the Card component's visual styling by simplifying the border appearance and deprecates the
contentStyleprop. The changes remove box shadows from the light theme and update the border color to usepalette.gray.light1for a cleaner, more subtle look. ThecontentStyleprop is now deprecated as we no longer want the Card component to be clickable at the root level.Key changes:
gray.light2togray.light1ContentStyleenum andcontentStyleprop with appropriate JSDoc commentsgetCardStyleshelper function🎟️ Jira ticket: LG-5747

✅ Checklist
pnpm changesetand documented my changes🧪 How to test changes
gray.light1instead ofgray.light2)contentStyleprop shows deprecation warnings in TypeScript/IDE