Skip to content

Commit

Permalink
Set base font size for each breakpoint (#295)
Browse files Browse the repository at this point in the history
* Set base font size for each breakpoint and testing for modular typography
* Change default scale value of modular-typography to 1 since that's in the doc
  • Loading branch information
yvonnetangsu authored and sherakama committed Feb 21, 2019
1 parent f763252 commit 403d237
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 98 deletions.
21 changes: 19 additions & 2 deletions core/css/decanter.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/scss/elements/typography/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ html {
}

body {
@include modular-typography-base;
color: $color-black;
font-size: $base-font-size;
}

p {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@charset 'UTF-8';

//
// @modular-typography-base
//
// Set base font-size for <body> at each breakpoint to use with modular typography.
//
// Style guide: Mixins.Modular.modular-typography-base
//
@mixin modular-typography-base($grid: $grid-media) {
@each $key, $breakpoint in $grid {
@include grid-media($key) {
font-size: map-get($modular-typography-base, $key);
}
}
}
27 changes: 4 additions & 23 deletions core/scss/utilities/mixins/modular-scale/_modular-typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
//
// Specify font size using modular-scale, relative to the base font size (which varies by breakpoint).
//
// `@include modular-typography(0)` returns the base font size for that breakpoint.
//
// **Examples:**
// - `@include modular-typography(2)`
// - `@include modular-typography(1.5)`
// - `@include modular-typography(0)`
// - `@include modular-typography(-1)`
//
// $scale - number (unitless) indicating how many steps to adjust font-size up or down the scale.
Expand All @@ -16,26 +18,5 @@
// Style guide: Mixins.Modular.modular-typography
//
@mixin modular-typography($scale: 1) {

font-size: modular-scale($scale, map-get($modular-typography, 'xs'));

@include grid-media('sm') {
font-size: modular-scale($scale, map-get($modular-typography, 'sm'));
}

@include grid-media('md') {
font-size: modular-scale($scale, map-get($modular-typography, 'md'));
}

@include grid-media('lg') {
font-size: modular-scale($scale, map-get($modular-typography, 'lg'));
}

@include grid-media('xl') {
font-size: modular-scale($scale, map-get($modular-typography, 'xl'));
}

@include grid-media('2xl') {
font-size: modular-scale($scale, map-get($modular-typography, '2xl'));
}
font-size: modular-scale($scale);
}
1 change: 1 addition & 0 deletions core/scss/utilities/mixins/modular-scale/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@

@import
'modular-spacing',
'modular-typography-base',
'modular-typography';
21 changes: 15 additions & 6 deletions core/scss/utilities/variables/core/_modular-typography.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
@charset "UTF-8";

//
// $modular-typography
// Modular Typography
//
// A unitless system for setting font sizes. The modular typography scale follows the Bourbon modular-scale mixin formula with a fixed scale ratio between each step.
// The scale is bi-directional, as font sizes can scale up or down.
//
// Note: modular-typography(0) will return the base font size at that breakpoint.
//
// Style guide: Variables.Core.ModularTypography
//

// $modular-typography-base
//
// A unitless system for assigning font sizes. These variables are the base font sizes for each break point.
// The base font sizes for each break point for use with the modular typography system which is based on the Bourbon modular scale.
//
// Markup: $modular-typography: (
// Markup: $modular-typography-base: (
// 'xs': 1.6rem,
// 'sm': 1.6rem,
// 'md': 1.8rem,
Expand All @@ -14,9 +23,9 @@
// '2xl': 1.9rem
// ) !default;
//
// Styleguide: Variables.Core.modular-typography
// Styleguide: Variables.Core.ModularTypography.modular-typography-base
//
$modular-typography: (
$modular-typography-base: (
'xs': 1.6rem,
'sm': 1.6rem,
'md': 1.8rem,
Expand Down
2 changes: 0 additions & 2 deletions core/scss/utilities/variables/core/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ $h5-font-size: 1.8rem !default;
//
$h6-font-size: 1.6rem !default;


//
// $base-line-height
//
Expand Down Expand Up @@ -161,7 +160,6 @@ $heading-line-height: 1.2 !default;
//
$lead-line-height: 1.5 !default;


//
// $font-sans
//
Expand Down
68 changes: 4 additions & 64 deletions kss/builder/decanter/kss-assets/css/kss.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 403d237

Please sign in to comment.