forked from michaeltaranto/basekick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mixin.scss
32 lines (28 loc) · 1.12 KB
/
mixin.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@function bk-calculateTypeOffset($line-height, $font-size, $descdender-height-scale){
$line-height-scale: $line-height / $font-size;
$line-height-scale: (($line-height-scale - 1) / 2) + $descdender-height-scale;
@return $line-height-scale;
}
@mixin bk-render($font-size, $line-height, $type-offset){
font-size: $font-size * 1px;
line-height: $line-height * 1px;
transform: translateY( $type-offset * 1em );
}
@mixin basekick(
$bk-type-size-modifier,
$bk-type-row-span,
$bk-descender-height-scale,
$bk-base-font-size,
$bk-grid-row-height,
$bk-line-height-override: false){
$font-size: $bk-type-size-modifier * $bk-base-font-size;
@if type-of($bk-line-height-override) == number {
$line-height: $bk-line-height-override;
$type-offset: bk-calculateTypeOffset($line-height, $font-size, $bk-descender-height-scale);
@include bk-render($font-size, $line-height, $type-offset);
} @else {
$line-height: $bk-grid-row-height * $bk-type-row-span;
$type-offset: bk-calculateTypeOffset($line-height, $font-size, $bk-descender-height-scale);
@include bk-render($font-size, $line-height, $type-offset);
}
}