Skip to content
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

Set Card content max-width #943

Merged
merged 5 commits into from
Mar 14, 2025

Conversation

danielguillan
Copy link
Contributor

Summary

Sets a maximum width for the heading and description of the Card component to prevent very long lines on wider cards.

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

Please try to provide before and after screenshots or videos

Before After

image

image

Copy link

changeset-bot bot commented Mar 12, 2025

🦋 Changeset detected

Latest commit: bdb51e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@primer/react-brand Patch
@primer/brand-primitives Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

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

Copy link
Contributor

github-actions bot commented Mar 12, 2025

🟢 No design token changes found

Copy link
Contributor

github-actions bot commented Mar 12, 2025

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@danielguillan danielguillan marked this pull request as ready for review March 12, 2025 13:18
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danielguillan it looks like the overall width of the card has been affected here somehow? Can't immediately see how that would happen though, any ideas? I wouldn't expect this diff here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rezrah Good catch! With this update, the card's maximum total width is now limited to 400px (based on the descriptions' max-width) instead of the 420px max-width set at the container level.

To avoid regressions, we could match the description's max-width to the cards' current max-width (i.e., 420px). Wdyt? We could set 400px on the full-width variant only, but I don't believe it's worth it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a good plan 👍. Yeah let's do that please. If we can limit scope of these changes to inner content only like the PR indicates, that would help reduce the testing burden and risks of regressions outside of the card.

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

One question for you @danielguillan, which looks like it could either be a regression or flakey test? Hopefully latter, as otherwise this could cause significant downstream regression too 🤔

@danielguillan danielguillan force-pushed the danielguillan/add-card-content-max-width branch from 6d53b8f to bdb51e0 Compare March 14, 2025 09:20
@danielguillan danielguillan requested a review from rezrah March 14, 2025 09:22
@danielguillan
Copy link
Contributor Author

danielguillan commented Mar 14, 2025

@rezrah I limited these changes to the full-width variant to avoid any potential regressions in card instances with an intrinsic size. The default variant, which has a maximum width at the container level, already constrains the content length.

Copy link
Collaborator

@rezrah rezrah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@danielguillan danielguillan merged commit 16b0cc7 into main Mar 14, 2025
17 checks passed
@danielguillan danielguillan deleted the danielguillan/add-card-content-max-width branch March 14, 2025 10:08
@primer-css primer-css mentioned this pull request Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants