forked from elastic/kibana
-
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.
[K7] Font sizing, weights, families and mixins (elastic#12879)
Sets up mixins and placeholders for typography.
- Loading branch information
Showing
7 changed files
with
100 additions
and
10 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
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,2 +1,3 @@ | ||
@import 'naming'; | ||
@import 'responsive'; | ||
@import 'typography'; |
63 changes: 63 additions & 0 deletions
63
ui_framework/components/global_styles/mixins/_typography.scss
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,63 @@ | ||
// Some mixins that help us deal with browser scaling of text more consistantly. | ||
// Essentially, fonts across kui should scale agains the root html element, not | ||
// against parent inheritance. | ||
|
||
|
||
// Typography mixins | ||
|
||
@function convertToRem($size) { | ||
@return #{$size / $kuiFontSize}rem; | ||
} | ||
|
||
// Spit out rem and px. This helps out people who might be on older versions of IE (<11). | ||
|
||
@mixin fontSize($size: $kuiFontSize) { | ||
font-size: $size; | ||
font-size: convertToRem($size); | ||
} | ||
|
||
%kuiFont { | ||
font-family: $kuiFontFamily; | ||
font-weight: $kuiFontWeightRegular; | ||
} | ||
|
||
%kuiCodeFont { | ||
font-family: $kuiCodeFontFamily; | ||
} | ||
|
||
// Font sizing extends, using rem mixin | ||
|
||
%kuiFontSize { | ||
@include fontSize($kuiFontSize); | ||
line-height: $kuiLineHeight; | ||
} | ||
|
||
%kuiFontSizeXS { | ||
@include fontSize($kuiFontSizeXS); | ||
line-height: $kuiLineHeight; | ||
} | ||
|
||
%kuiFontSizeS { | ||
@include fontSize($kuiFontSizeS); | ||
line-height: $kuiLineHeight; | ||
} | ||
|
||
%kuiFontSizeM { | ||
@include fontSize($kuiFontSizeM); | ||
line-height: $kuiLineHeight; | ||
} | ||
|
||
%kuiFontSizeL { | ||
@include fontSize($kuiFontSizeL); | ||
line-height: $kuiLineHeight * 1.5; | ||
} | ||
|
||
%kuiFontSizeXL { | ||
@include fontSize($kuiFontSizeXL); | ||
line-height: $kuiLineHeight * 2; | ||
} | ||
|
||
%kuiFontSizeXXL { | ||
@include fontSize($kuiFontSizeXXL); | ||
line-height: $kuiLineHeight * 3; | ||
} |
25 changes: 25 additions & 0 deletions
25
ui_framework/components/global_styles/variables/_typography.scss
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,25 @@ | ||
// Font | ||
|
||
// Families | ||
$kuiFontFamily: "Roboto", Helvetica, Arial, sans-serif; | ||
$kuiCodeFontFamily: "Roboto Mono", monospace; | ||
|
||
// Font sizes | ||
$kuiFontSize: $kuiSize; | ||
|
||
$kuiFontSizeXS: 12px; | ||
$kuiFontSizeS: 14px; | ||
$kuiFontSizeM: $kuiFontSize; | ||
$kuiFontSizeL: 24px; | ||
$kuiFontSizeXL: 32px; | ||
$kuiFontSizeXXL: 48px; | ||
|
||
// Line height | ||
|
||
$kuiLineHeight: 1.5 * $kuiFontSize; | ||
|
||
// Font weights | ||
|
||
$kuiFontWeightLight: 300; | ||
$kuiFontWeightRegular: 400; | ||
$kuiFontWeightMedium: 500; |
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
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
File renamed without changes.