Skip to content

Commit

Permalink
feat(typography): update typography to match designs (#160)
Browse files Browse the repository at this point in the history
* feat(typography): update typography to match designs

added display2 and button + buttonLink 1 to 3

* change button 3 to bold
  • Loading branch information
nathanjamal authored Mar 15, 2023
1 parent abad885 commit 9a601a7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .storybook/blocks/Changelog/Changelog.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
}

& h1:global(.sbdocs) {
@mixin button_medium__bold;
@mixin typography-button-2;

margin: var(--gap-2xl) 0 var(--gap-m);
color: var(--color-light-text-primary);
border-bottom: 1px solid var(--color-light-border-secondary);

& a {
@mixin button_small__medium;
@mixin typography-button-3;

border: none;
}
}

& h2:global(.sbdocs) {
@mixin button_small__medium;
@mixin typography-button-3;

border: 0;
box-shadow: none;
Expand All @@ -43,7 +43,7 @@
}

& a {
@mixin button_small__medium;
@mixin typography-button-3;

border: none;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/typography/src/Typography.constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const defaultVariantMapping = {
display1: 'p',
display2: 'p',
h1: 'h1',
h2: 'h2',
h3: 'h3',
Expand All @@ -21,4 +22,10 @@ export const defaultVariantMapping = {
caption5: 'caption',
overline1: 'span',
overline2: 'span',
button1: 'span',
button2: 'span',
button3: 'span',
buttonLink1: 'span',
buttonLink2: 'span',
buttonLink3: 'span',
} as const;
3 changes: 2 additions & 1 deletion packages/typography/src/docs/Description.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ In case you want to change the HTML tag the text should be wrapped, you can set

Several typography elements are available in the library. They are listed below.

- Display (`variant="display1"`)
- Display (`variant="display1|display2"`)
- Heading (`variant="h1|h2|h3|h4|h5|h6"`)
- Sub heading (`variant="subheading1|subheading2|subheading3|subheading4"`)
- Body (`variant="body1|body2|body3|body4"`)
- Caption (`variant="caption1|caption2|caption3|caption4|caption5"`)
- Overline (`variant="overline1|overline2"`)
- Button (`variant="button1|button2|button3|buttonLink1|buttonLink2|buttonLink3"`)

If this prop is not set, the default is `variant="body3"`. You can try the different variants in the playground below.

Expand Down
38 changes: 34 additions & 4 deletions packages/typography/src/styles/variant.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
@mixin typography-display;
}

.display2 {
@mixin typography-display-2;
}

/*
Heading
*/
Expand Down Expand Up @@ -54,14 +58,40 @@
}
}

/*
Button
*/
.button1 {
@mixin typography-button-1;
}

.button2 {
@mixin typography-button-2;
}

.button3 {
@mixin typography-button-3;
}

.buttonLink1 {
@mixin typography-button-1;
text-decoration: underline;
}

.buttonLink2 {
@mixin typography-button-2;
text-decoration: underline;
}

.buttonLink3 {
@mixin typography-button-3;
text-decoration: underline;
}

/*
Mobile
*/
@media screen and (max-width: 768px) {
.display1 {
@mixin typography-display_mobile;
}

/* @for $i from 1 to 5 {
.h1$(i) {
@mixin typography-heading-$(i) _mobile;
Expand Down
47 changes: 42 additions & 5 deletions packages/vars/src/typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,31 @@
Heading
*/
@define-mixin typography-display {
font-size: 60px;
line-height: 68px;
letter-spacing: -2.5px;
font-size: 48px;
line-height: 56px;
letter-spacing: -2px;
font-family: var(--font-family-system);
font-weight: var(--font-weight-xbold);

@media (--tablet) {
font-size: 60px;
line-height: 68px;
letter-spacing: -2.5px;
}
}

@define-mixin typography-display_mobile {
@mixin typography-display;
@define-mixin typography-display-2 {
font-size: 48px;
line-height: 56px;
letter-spacing: -2px;
font-family: var(--font-family-system);
font-weight: var(--font-weight-bold);

@media (--tablet) {
font-size: 60px;
line-height: 68px;
letter-spacing: -2.5px;
}
}

@define-mixin typography-heading-1 {
Expand Down Expand Up @@ -209,6 +222,30 @@
/*
Button
*/
@define-mixin typography-button-1 {
font-size: 16px;
font-weight: var(--font-weight-bold);
letter-spacing: 0.2px;
font-family: var(--font-family-system);
}

@define-mixin typography-button-2 {
font-size: 14px;
font-weight: var(--font-weight-bold);
letter-spacing: 0.2px;
font-family: var(--font-family-system);
}

@define-mixin typography-button-3 {
font-size: 12px;
font-weight: var(--font-weight-bold);
letter-spacing: 0.2px;
font-family: var(--font-family-system);
}

/*
Button Old - DO NOT USE
*/
@define-mixin button_large__bold {
font-size: 16px;
font-weight: 700;
Expand Down

1 comment on commit 9a601a7

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.7% 1188/1216
🟢 Branches 85.53% 266/311
🟢 Functions 94.79% 91/96
🟢 Lines 98.27% 1082/1101

Test suite run success

273 tests passing in 41 suites.

Report generated by 🧪jest coverage report action from 9a601a7

Please sign in to comment.