-
Notifications
You must be signed in to change notification settings - Fork 3
/
_typeStyle.scss
50 lines (47 loc) · 1.45 KB
/
_typeStyle.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
@mixin typeStyle
Loops a typeset to generate styles objects
and then generates CSS as required
*/
@mixin typeStyle($settings) {
// set the various font info per breakpoint
@if $settings {
$_settingsCache: ();
// loop the breakpoints in the setttings
@each $breakpoint, $font-info in $settings {
// check this is a valid breakpoint
@if map-has-key($a17-breakpoints-with-directions, $breakpoint) {
$_settings: ();
// get font info for this breakpoint
// conditionally so can be inherited from smaller screens
@each $attribute, $setting in $font-info {
$cachedSetting: map-get($_settingsCache, $attribute);
@if not $cachedSetting or $cachedSetting != $setting {
$_settingsCache: map-merge($_settingsCache, (
$attribute: $setting)
);
$_settings: map-merge($_settings, (
$attribute: $setting)
);
}
}
// check if this is the smallest breakpoint (the default font setting)
@if (index(map-keys($settings), $breakpoint) == 1) {
@include typeAttribute($_settings);
b,
strong {
font-weight: var(--bold-weight);
}
i,
em {
font-style: italic;
}
} @else {
@include breakpoint("#{$breakpoint}+") {
@include typeAttribute($_settings);
}
}
}
}
}
}