fix(heading): keep unit on margin values like mx="2rem"#3588
Conversation
withSpace appended px to any value whose leading number parsed, so a string with a unit (mx="2rem", my="10%") became invalid CSS like "2rempx". Suffix px only for bare numbers; pass unit values through.
|
@yashs33244 is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: b86d9ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Fixes a CSS unit handling bug in Heading margin props, adding a simple regex check to pass through strings with units. The change is small, well-tested, and does not affect core logic or other components.
Re-trigger cubic
|
I believe this would be a breaking change here. And the |
What
Headingacceptsm/mx/my/mt/mr/mb/mlasnumber | string, butwithSpaceappendedpxto any value whose leading number parsed. So a string that already carries a unit produced invalid CSS:parseFloat("2rem")is2(not NaN), so the existing guard let it through and${value}pxmangled it.Fix
Suffix
pxonly when the value is a bare number (or a unitless numeric string). Strings that already have a unit are passed through untouched. Numbers and unitless strings likemx={4}/mx="20"are unchanged. Added a regression test inutils.spec.ts.Summary by cubic
Fixes
Headingmargin props to keep units (e.g., mx="2rem", my="10%") and only add "px" for bare numbers, preventing invalid CSS. Unitless numbers and numeric strings still get "px".withSpaceto detect unit-bearing strings and pass them through unchanged.rem,%, andem(including negative values) inutils.spec.tsforreact-email.Written for commit b86d9ff. Summary will update on new commits.