Created
May 23, 2020 23:44
-
-
Save andriytyurnikov/659fc91d50ea1cc5eeb1df23fe35ec04 to your computer and use it in GitHub Desktop.
basekick.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
@mixin basekick( | |
$baseFontSize, | |
$typeSizeModifier, | |
$descenderHeightScale, | |
$capHeightScale, | |
$typeRowSpan, | |
$gridRowHeight, | |
$preventCollapse : 1 | |
) { | |
$_lineHeight : $typeRowSpan * $gridRowHeight; | |
$_fontSize : $typeSizeModifier * $baseFontSize; | |
$_lineHeightScale : $_lineHeight/$_fontSize; | |
$_typeOffset : | |
(($_lineHeightScale - 1)/2 + $descenderHeightScale) * 1em; | |
$_topSpace : | |
$_lineHeight - ($capHeightScale * $_fontSize); | |
$_heightCorrection : | |
if(($_topSpace > $gridRowHeight), ($_topSpace - ($_topSpace % $gridRowHeight)), 0); | |
$_fullHeightCorrection : | |
$_heightCorrection + $preventCollapse; | |
vertical-align: baseline; | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
padding-top: 1px * $preventCollapse; | |
font-size: 1px * $_fontSize; | |
line-height: 1px * $_lineHeight; | |
transform: translateY($_typeOffset); | |
&::before { | |
display: block; | |
content: ""; | |
height: 0; | |
margin-top: -1 * 1px * $_fullHeightCorrection; | |
} | |
} | |
$headingBaseFontSize: 22.4; | |
$headingCapHeightScale : 0.877; | |
$headingDescenderHeightScale : 0.123; | |
$bodyBaseFontSize: 22.4; | |
$bodyCapHeightScale : 0.8685; | |
$bodyDescenderHeightScale : 0.1315; | |
$verticalRowHeight : 8; | |
@mixin basekick-heading( | |
$typeSizeModifier, | |
$typeRowSpan, | |
$descenderHeightScale: $headingDescenderHeightScale, | |
$capHeightScale: $headingCapHeightScale, | |
$baseFontSize: $headingBaseFontSize, | |
$gridRowHeight : $verticalRowHeight, | |
$preventCollapse : 1 | |
) { | |
@include basekick( | |
$baseFontSize, | |
$typeSizeModifier, | |
$descenderHeightScale, | |
$capHeightScale, | |
$typeRowSpan, | |
$gridRowHeight, | |
$preventCollapse | |
) | |
} | |
@mixin basekick-body( | |
$typeSizeModifier, | |
$typeRowSpan, | |
$descenderHeightScale: $bodyDescenderHeightScale, | |
$capHeightScale: $bodyCapHeightScale, | |
$baseFontSize: $bodyBaseFontSize, | |
$gridRowHeight : $verticalRowHeight, | |
$preventCollapse : 1 | |
) { | |
@include basekick( | |
$baseFontSize, | |
$typeSizeModifier, | |
$descenderHeightScale, | |
$capHeightScale, | |
$typeRowSpan, | |
$gridRowHeight, | |
$preventCollapse | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment