Skip to content

Commit

Permalink
feat(Heading): update bottom margin for H2 and H4 (#3576)
Browse files Browse the repository at this point in the history
* feat(Heading): update bottom margin for H2 and H4 to sit on 8px scale

* chore: add changeset

* chore: update heading tests

---------

Co-authored-by: “nora <[email protected]>
  • Loading branch information
serifluous and nkrantz authored Oct 24, 2023
1 parent d1f89ea commit 26577a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/wild-oranges-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/heading": patch
"@twilio-paste/core": patch
---

Update bottom margin on H2 and H4 by one spacing token step
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Heading", () => {
);
const renderedHeading = screen.getByRole("heading", { level: 2 });
expect(renderedHeading).not.toBeNull();
expect(renderedHeading).toHaveStyleRule("margin-bottom", "1.25rem");
expect(renderedHeading).toHaveStyleRule("margin-bottom", "1.5rem");
expect(renderedHeading).toHaveStyleRule("font-size", "1.5rem");
expect(renderedHeading).toHaveStyleRule("font-weight", "600");
expect(renderedHeading).toHaveStyleRule("line-height", "2rem");
Expand Down Expand Up @@ -65,7 +65,7 @@ describe("Heading", () => {
);
const renderedHeading = screen.getByRole("heading", { level: 4 });
expect(renderedHeading).not.toBeNull();
expect(renderedHeading).toHaveStyleRule("margin-bottom", "0.75rem");
expect(renderedHeading).toHaveStyleRule("margin-bottom", "0.5rem");
expect(renderedHeading).toHaveStyleRule("font-size", "1rem");
expect(renderedHeading).toHaveStyleRule("font-weight", "600");
expect(renderedHeading).toHaveStyleRule("line-height", "1.5rem");
Expand Down Expand Up @@ -115,7 +115,7 @@ describe("Heading", () => {
const renderedHeadingIdiomatic = screen.getByText("This is an italic H2").closest("i");
expect(renderedHeading).not.toBeNull();
expect(renderedHeadingIdiomatic).not.toBeNull();
expect(renderedHeading).toHaveStyleRule("margin-bottom", "1.25rem");
expect(renderedHeading).toHaveStyleRule("margin-bottom", "1.5rem");
expect(renderedHeading).toHaveStyleRule("font-size", "1.5rem");
expect(renderedHeading).toHaveStyleRule("font-weight", "600");
expect(renderedHeading).toHaveStyleRule("line-height", "2rem");
Expand Down
4 changes: 2 additions & 2 deletions packages/paste-core/components/heading/src/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
};
case "heading40":
return {
marginBottom: marginBottom || "space40",
marginBottom: marginBottom || "space30",
fontSize: "fontSize40",
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight40",
Expand Down Expand Up @@ -53,7 +53,7 @@ function getHeadingProps(headingVariant?: HeadingVariants, marginBottom?: "space
case "heading20":
default:
return {
marginBottom: marginBottom || "space60",
marginBottom: marginBottom || "space70",
fontSize: "fontSize70",
fontWeight: "fontWeightSemibold",
lineHeight: "lineHeight70",
Expand Down

0 comments on commit 26577a2

Please sign in to comment.