summaryrefslogtreecommitdiffstats
path: root/src/mixins/_typography.scss
blob: 31e39f02825d02a898471cc3af4ca5bf427c7840 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
@function set-font($basis, $values: ()) {
    $font: map-merge($basis, $values);

    $map: (font-family: map-get($font, 'family'));

    @if (map-has-key($font, 'size')) {
        $map: map-merge(
            $map, (
                font-size: map-get($font, 'size')
            )
        );
    }

    @if (map-has-key($font, 'weight')) {
        $map: map-merge(
            $map, (
                font-weight: map-get($font, 'weight')
            )
        );
    }

    @if (map-has-key($font, 'style')) {
        $map: map-merge(
            $map, (
                font-style: map-get($font, 'style')
            )
        );
    }

    @if (map-has-key($font, 'line-height')) {
        $map: map-merge(
            $map, (
                line-height: map-get($font, 'line-height')
            )
        );
    }

    @if (map-has-key($font, 'transform')) {
        $map: map-merge(
            $map, (
                text-transform: map-get($font, 'transform')
            )
        );
    }

    @if (map-has-key($font, 'variant-alternates')) {
        $map: map-merge(
            $map, (
                font-variant-alternates: map-get($font, 'variant-alternates')
            )
        );
    }

    @return $map;
}

@mixin set-font($basis, $values: ()) {
    $values: set-font($basis, $values);

    @each $prop, $value in $values {
        #{$prop}: $value;
    }
}