blob: c9c7b05c80d41f5bb18073726dc9c35b26a38073 (
plain)
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
33
34
35
36
37
38
39
40
|
@charset "utf-8";
// Built-In Modules
@use 'sass:math';
// Included Modules
@use 'calc-font-size';
@use 'strip-unit';
@function stack($line-height: 1, $font-size: 16px, $base-size: 16px) {
@if math.unit($font-size) == '%' {
$font-size: calc-font-size.percent2px($font-size, $base-size);
} @else if math.unit($font-size) == 'em' {
$font-size: calc-font-size.em2px($font-size, $base-size);
} @else if math.unit($font-size) == 'rem' {
$font-size: calc-font-size.rem2px($font-size, $base-size);
}
$line-height-px-unit: strip-unit.strip-unit($line-height) * strip-unit.strip-unit($font-size);
$stack: calc-font-size.px2rem($line-height-px-unit, $base-size);
@return $stack;
}
@function line-height($line-space: 4px, $font-size: 16px, $base-size: 16px) {
@if math.unit($font-size) == '%' {
$font-size: calc-font-size.percent2px($font-size, $base-size);
} @else if math.unit($font-size) == 'em' {
$font-size: calc-font-size.em2px($font-size, $base-size);
} @else if math.unit($font-size) == 'rem' {
$font-size: calc-font-size.rem2px($font-size, $base-size);
}
$font-size: strip-unit.strip-unit($font-size);
$line-space: strip-unit.strip-unit($line-space);
$line-height: math.div(($line-space * 2) + $font-size, $font-size);
@return $line-height;
}
|