Skip to content

Commit

Permalink
Merge pull request #7025 from Sage/FE-6232
Browse files Browse the repository at this point in the history
feat(typography): update line heights to align with DS
  • Loading branch information
nineteen88 authored Oct 24, 2024
2 parents 7c0955e + 6a9c0a7 commit e43ee70
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
20 changes: 12 additions & 8 deletions src/components/typography/typography.pw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,27 @@ const getLineHeight = (variant: VariantTypes) => {
case "h1-large":
return "40px";
case "h1":
case "segment-subheader":
return "31px";
return "30px";
case "h2":
return "29px";
return "27.5px";
case "h3":
return "25px";
case "h4":
return "22.5px";
case "h5":
return "20px";
case "segment-header":
return "26px";
return "25px";
case "segment-header-small":
return "22.5px";
case "segment-subheader":
return "24px";
case "big":
return "24px";
case "h4":
case "segment-header-small":
return "23px";
case "small":
case "sub":
case "sup":
return "20px";
case "h5":
case "segment-subheader-alt":
case "p":
case "span":
Expand Down
20 changes: 12 additions & 8 deletions src/components/typography/typography.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,27 @@ const getLineHeight = (variant?: VariantTypes) => {
case "h1-large":
return "40px";
case "h1":
case "segment-subheader":
return "31px";
return "30px";
case "h2":
return "29px";
return "27.5px";
case "h3":
return "25px";
case "h4":
return "22.5px";
case "h5":
return "20px";
case "segment-header":
return "26px";
return "25px";
case "segment-header-small":
return "22.5px";
case "segment-subheader":
return "24px";
case "big":
return "24px";
case "h4":
case "segment-header-small":
return "23px";
case "small":
case "sub":
case "sup":
return "20px";
case "h5":
case "segment-subheader-alt":
case "p":
case "span":
Expand Down
16 changes: 8 additions & 8 deletions src/components/typography/typography.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test("should render with expected styles when variant is 'h1'", () => {

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "24px",
lineHeight: "31px",
lineHeight: "30px",
fontWeight: "700",
textTransform: "none",
textDecoration: "none",
Expand All @@ -47,7 +47,7 @@ test("should render with expected styles when variant is 'h2'", () => {

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "22px",
lineHeight: "29px",
lineHeight: "27.5px",
fontWeight: "500",
textTransform: "none",
textDecoration: "none",
Expand All @@ -60,7 +60,7 @@ test("should render with expected styles when variant is 'h3'", () => {

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "20px",
lineHeight: "26px",
lineHeight: "25px",
fontWeight: "500",
textTransform: "none",
textDecoration: "none",
Expand All @@ -73,7 +73,7 @@ test("should render with expected styles when variant is 'h4'", () => {

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "18px",
lineHeight: "23px",
lineHeight: "22.5px",
fontWeight: "400",
textTransform: "none",
textDecoration: "none",
Expand All @@ -86,7 +86,7 @@ test("should render with expected styles when variant is 'h5'", () => {

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "16px",
lineHeight: "21px",
lineHeight: "20px",
fontWeight: "400",
textTransform: "none",
textDecoration: "none",
Expand All @@ -99,7 +99,7 @@ test("should render with expected styles when variant is 'segment-header'", () =

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "20px",
lineHeight: "26px",
lineHeight: "25px",
fontWeight: "700",
textTransform: "none",
textDecoration: "none",
Expand All @@ -112,7 +112,7 @@ test("should render with expected styles when variant is 'segment-header-small'"

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "18px",
lineHeight: "23px",
lineHeight: "22.5px",
fontWeight: "700",
textTransform: "none",
textDecoration: "none",
Expand All @@ -125,7 +125,7 @@ test("should render with expected styles when variant is 'segment-subheader'", (

expect(screen.getByText("Test")).toHaveStyle({
fontSize: "16px",
lineHeight: "31px",
lineHeight: "24px",
fontWeight: "500",
textTransform: "none",
textDecoration: "none",
Expand Down

0 comments on commit e43ee70

Please sign in to comment.