generated from abelflopes/lerna-monorepo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use mixin based typography
- Loading branch information
1 parent
9af8f07
commit 878fb6e
Showing
3 changed files
with
151 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,39 @@ | ||
@import "@react-ck/theme"; | ||
@import "variables"; | ||
|
||
@mixin text-variant($key, $map) { | ||
$props: map-get-strict($map, $key); | ||
$defaultProps: map-get-strict($props, default); | ||
$hoverProps: map-get-strict($props, hover); | ||
|
||
@each $propName, $propValue in $defaultProps { | ||
@include define-css-var(text, $propName, $propValue); | ||
} | ||
|
||
&:hover { | ||
@each $propName, $propValue in $hoverProps { | ||
@include define-css-var(text, $propName, $propValue); | ||
} | ||
} | ||
} | ||
|
||
@mixin text-variation($key) { | ||
@include text-variant($key, $text-variations); | ||
} | ||
|
||
@mixin text-type($key) { | ||
@include text-variant($key, $text-types); | ||
} | ||
|
||
// TODO: move to typography | ||
@mixin font-base { | ||
font-family: get-css-var(font, family); | ||
font-size: get-css-var(font, base-size); | ||
@include text-type(p); | ||
@include define-css-var(text, color, get-color(neutral-900)); | ||
@include define-css-var(text, text-decoration, none); | ||
|
||
font-family: get-css-var(text, font-family); | ||
font-size: get-css-var(text, font-size); | ||
font-weight: get-css-var(text, font-weight); | ||
line-height: get-css-var(text, line-height); | ||
text-decoration: get-css-var(text, text-decoration); | ||
color: get-css-var(text, color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
@import "@react-ck/theme"; | ||
@import "@react-ck/scss-utils"; | ||
|
||
$text-types: ( | ||
p: ( | ||
default: ( | ||
font-family: get-css-var(font, family), | ||
font-size: get-css-var(font, base-size), | ||
line-height: 24px, | ||
font-weight: 500, | ||
color: get-color(neutral-900), | ||
), | ||
hover: (), | ||
), | ||
huge: ( | ||
default: ( | ||
font-size: 60px, | ||
font-weight: 700, | ||
line-height: 60px, | ||
), | ||
hover: (), | ||
), | ||
soft: ( | ||
default: ( | ||
color: #718096, | ||
), | ||
hover: (), | ||
), | ||
h1: ( | ||
default: ( | ||
font-size: 29px, | ||
font-weight: 500, | ||
line-height: 36px, | ||
), | ||
hover: (), | ||
), | ||
h2: ( | ||
default: ( | ||
font-size: 24px, | ||
font-weight: 500, | ||
line-height: 36px, | ||
color: #1a202c, | ||
), | ||
hover: (), | ||
), | ||
h3: ( | ||
default: ( | ||
font-size: 20px, | ||
font-weight: 500, | ||
line-height: 24px, | ||
), | ||
hover: (), | ||
), | ||
h4: ( | ||
default: (), | ||
hover: (), | ||
), | ||
h5: ( | ||
default: (), | ||
hover: (), | ||
), | ||
h6: ( | ||
default: (), | ||
hover: (), | ||
), | ||
); | ||
|
||
$text-variations: ( | ||
small: ( | ||
default: ( | ||
font-size: 14px, | ||
font-weight: 400, | ||
line-height: 21px, | ||
), | ||
hover: (), | ||
), | ||
bold: ( | ||
default: ( | ||
font-weight: 700, | ||
), | ||
hover: (), | ||
), | ||
link: ( | ||
default: ( | ||
color: #0052cc, | ||
), | ||
hover: ( | ||
color: #003e99, | ||
), | ||
), | ||
link_hidden: ( | ||
default: ( | ||
text-decoration: none, | ||
), | ||
hover: ( | ||
color: #003e99, | ||
text-decoration: underline, | ||
), | ||
), | ||
inverted: ( | ||
default: ( | ||
color: get-color(neutral-0), | ||
), | ||
hover: (), | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters