Skip to content

Commit

Permalink
Replace typography source to monday-ui-style font variables (#521)
Browse files Browse the repository at this point in the history
* add css variables for typography

* remove use on old less variables

* fix typography

* fix typography description

* add argument to font mixins

* update monday-ui-style
  • Loading branch information
Hadas Farhi authored Feb 8, 2022
1 parent fdd19db commit cdbbb9b
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 128 deletions.
10 changes: 5 additions & 5 deletions src/components/AttentionBox/AttentionBox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

.monday-style-attention-box-component {
position: relative;
padding: $spacing-large;
border-radius: $border-radius-medium;
font-size: $font-size-input;
padding: var(--spacing-large);
border-radius: var(--border-radius-medium);
font-size: var(--font-size-general-label);
width: fit-content;
height: fit-content;
@include theme-prop(color, dark-color);
Expand Down Expand Up @@ -69,7 +69,7 @@
margin-bottom: var(--spacing-small);

&__icon {
margin-right: $spacing-small;
margin-right: var(--spacing-small);
}

&__title {
Expand All @@ -79,7 +79,7 @@
}

&.with-close {
padding: $spacing-large $spacing-xxl $spacing-large $spacing-large;
padding: var(--spacing-large) var(--spacing-xxl) var(--spacing-large) var(--spacing-large);
}

&__close-icon {
Expand Down
9 changes: 6 additions & 3 deletions src/components/Avatar/AvatarContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
$avatar-icon-large: 28px;
$avatar-icon-medium: 18px;
$avatar-icon-small: 12px;
$font-size-avatar-large: 18px;
$font-size-avatar-medium: 14px;
$font-size-avatar-small: 12px;

.monday-style-avatar-content {
&_img {
Expand All @@ -12,9 +15,9 @@ $avatar-icon-small: 12px;
}

&_text {
font-family: $primary-font;
font-weight: $font-weight-normal;
line-height: $line-height-for-size-18;
font-family: var(--font-family);
font-weight: var(--font-weight-normal);
line-height: 21px;
letter-spacing: -0.5px;
display: flex;
justify-content: center;
Expand Down
1 change: 0 additions & 1 deletion src/components/Button/Button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
outline: none;
border: none;
height: auto;
font-family: Roboto, sans-serif;
border-radius: $border-radius-small;
cursor: pointer;
white-space: nowrap;
Expand Down
4 changes: 2 additions & 2 deletions src/components/FieldLabel/FieldLabel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
padding-bottom: $spacing-small;
align-items: center;
.label-component--icon {
margin: 0 $spacing-small 0 $spacing-xs;
margin: 0 var(--spacing-small) 0 var(--spacing-xs);
line-height: 24px;
font-size: $font-size-input;
font-size: var(--font-size-general-label);
@include theme-prop(color, icon-color);
}
.label-component--text {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormattedNumber/FormattedNumber.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
display: flex;
flex-direction: row;
box-sizing: border-box;
font-family: $primary-font;
font-family: var(--font-family);
width: 100%;

&__prefix {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

.monday-style-step-indicator-component {
@include theme-prop(color, text-color-on-primary);
font-size: $font-size-input;
font-size: var(--font-size-general-label);
display: flex;
margin: 0;
padding: 0;
Expand All @@ -30,7 +30,7 @@

&__subtitle__text {
width: 100%;
font-size: $font-size-default;
font-size: var(--font-size-general-label);
@include theme-prop(color, disabled-text-color);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
flex-direction: row;
justify-content: center;
width: 100%;
font-family: $primary-font;
font-size: $font-size-input;
font-family: var(--font-family);
font-size: var(--font-size-general-label);
@include theme-prop(color, secondary-text-color);

.linear-progress-bar__label {
padding-left: $spacing-xs;
padding-left: var(--spacing-xs)
}

&__large {
Expand Down
6 changes: 3 additions & 3 deletions src/components/TextField/TextField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.input-component {
position: relative;
box-sizing: border-box;
font-family: Roboto, sans-serif;
font-family: var(--font-family);
width: 100%;

& * {
Expand Down Expand Up @@ -227,7 +227,7 @@
outline: none;

.input-component__icon {
font-size: $font-size-paragraph;
font-size: var(--font-size-paragraph);
}

&:hover + .input-component__icon--container + .input-component__input {
Expand All @@ -251,7 +251,7 @@
height: 40px;
width: 40px;
.input-component__icon {
font-size: $font-size-paragraph;
font-size: var(--font-size-paragraph);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.description-label{
color: var(--secondary-text-color);
font-family: $primary-font;
font-weight: $font-weight-normal;
font-family: var(--font-family);
font-weight: var(--font-weight-normal);
line-height: 24px;
padding: 8px;
white-space: pre-line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const TextStyles = () => {
className="monday-storybook-text-description"
ariaLabel="H2"
title="Secondary heading (Roboto 24px bold)"
description="Use as main header on a page"
description="Use as secondary header on a page"
>
<Heading
type={Heading.types.h2}
Expand All @@ -46,7 +46,7 @@ export const TextStyles = () => {
className={CSS_BASE_CLASS}
ariaLabel="H3"
title="Tertiary heading (Roboto 24px light)"
description="Use as main header on a page"
description="Use after heading, profile page headings"
>
<Heading
type={Heading.types.h3}
Expand All @@ -61,7 +61,7 @@ export const TextStyles = () => {
className={CSS_BASE_CLASS}
ariaLabel="H4"
title="Fourth heading (Roboto 18px bold)"
description="Use as main header on a page"
description="Use for subtitles, group name, subheading in admin"
>
<Heading
type={Heading.types.h4}
Expand All @@ -74,9 +74,9 @@ export const TextStyles = () => {
</VisualDescription>
<VisualDescription
ariaLabel="H5"
title="Fourth heading (Roboto 18px bold)"
title="Fourth heading (Roboto 16px bold)"
className={CSS_BASE_CLASS}
description="Use as main header on a page"
description="Use as subtitles for paragraphs"
>
<Heading
type={Heading.types.h5}
Expand All @@ -90,7 +90,7 @@ export const TextStyles = () => {
<VisualDescription
ariaLabel="text"
title="UI labels / General text (Roboto 14px normal)"
description="Use as main header on a page"
description="Use for general text or labels"
className={CSS_BASE_CLASS}
>
<span
Expand Down
2 changes: 1 addition & 1 deletion src/storybook/styles/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// font family
$header-primary-font: "Sofia Pro", Roboto, sans-serif;
$text-primary-font: Roboto, sans-serif;
$text-primary-font: var(--font-family);

// sizes
$h1-font-size: 40px;
Expand Down
123 changes: 24 additions & 99 deletions src/styles/typography.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
@import "./theme-mixin";

$primary-font: Roboto, sans-serif;
$font-weight-bold: 500;
$font-weight-normal: 400;
$font-weight-light: 300;
$font-weight-very-light: 200;
$font-size-caption: 14px;
$font-size-input: 14px;
$font-size-text: 14px;
$font-size-paragraph: 16px;
$font-size-subtitle: 18px;
$font-size-secondary: 24px;
$font-size-header: 32px;
$font-size-avatar-large: 18px;
$font-size-avatar-medium: 14px;
$font-size-avatar-small: 12px;
$line-height-for-size-32: 52px;
$line-height-for-size-24: 32px;
$line-height-for-size-18: 21px;
$font-size-default: 14px;

$h1-empty-state-height: 32px;
$h2-empty-state-height: 24px;
$h3-empty-state-height: 24px;
Expand All @@ -29,129 +9,74 @@ $p-empty-state-height: 16px;
$h6-empty-state-height: 12px;
$small-empty-state-height: 12px;

@mixin base-font($font-variable) {
@include theme-prop(color, primary-text-color);
-webkit-font-smoothing: var(--font-smoothing-webkit);
-moz-osx-font-smoothing: var(--font-smoothing-moz);
font: $font-variable;
}

// Main Heading (h1)
@mixin font-main {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-bold;
font-size: $font-size-header;
@include base-font(var(--font-h1));
letter-spacing: -1px;
line-height: $line-height-for-size-32;
@include theme-prop(color, primary-text-color);
}

// Secondary Heading (h2)
@mixin font-title {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-bold;
font-size: $font-size-secondary;
@include base-font(var(--font-h2));
letter-spacing: -0.2px;
line-height: $line-height-for-size-24;
@include theme-prop(color, primary-text-color);
}

// Tertiary Heading (h3)
@mixin font-title-secondary {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-light;
font-size: $font-size-secondary;
@include base-font(var(--font-h3));
letter-spacing: -0.2px;
line-height: $line-height-for-size-24;
@include theme-prop(color, primary-text-color);
}

// Fourth Heading (h4)
@mixin font-subtitle {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-bold;
font-size: $font-size-subtitle;
line-height: 24px;
@include theme-prop(color, primary-text-color);
@include base-font(var(--font-h4));
}

// Paragraph Bold (h5)
@mixin font-paragraph-bold {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-size: $font-size-paragraph;
font-weight: $font-weight-bold;
line-height: 24px;
@include theme-prop(color, primary-text-color);
@include base-font(var(--font-h5));
}

// UI lables / General text (h6)
@mixin font-general-text {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-normal;
font-size: $font-size-text;
line-height: 24px;
@include theme-prop(color, primary-text-color);
@include base-font(var(--font-general-label));
}

// Paragraph text (p)
@mixin font-paragraph {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-weight: $font-weight-normal;
font-size: $font-size-paragraph;
line-height: 24px;
@include theme-prop(color, primary-text-color);
@include base-font(var(--font-paragraph));
}

// Please use general text instead of this
@mixin font-default {
@include font-general-text;
line-height: 22px;
}

// Caption / Subtext (small)
@mixin font-caption {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-size: $font-size-caption;
font-weight: $font-weight-normal;
@include theme-prop(color, secondary-text-color);
line-height: 18px;
@include base-font(var(--font-subtext));
}

@mixin font-input {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-size: $font-size-input;
font-weight: $font-weight-normal;
line-height: 22px;
@include theme-prop(color, primary-text-color);
@include font-default;
}

@mixin font-link {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-size: $font-size-text;
font-weight: $font-weight-normal;
line-height: 22px;
@include font-default;
text-decoration: none;
@include theme-prop(color, link-color);
}

@mixin font-default {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $primary-font;
font-size: $font-size-input;
font-weight: $font-weight-normal;
line-height: 22px;
@include theme-prop(color, primary-text-color);
}

@mixin line-clamp($lines: 1) {
@mixin line-clamp($lines: 1le) {
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: $lines;
Expand Down

0 comments on commit cdbbb9b

Please sign in to comment.