|
29 | 29 | @return if($font-family == null, $font-family, unquote($font-family));
|
30 | 30 | }
|
31 | 31 |
|
32 |
| -// Converts a typography level into CSS styles. |
33 |
| -@mixin mat-typography-level-to-styles($config, $level) { |
34 |
| - $font-size: mat-font-size($config, $level); |
35 |
| - $font-weight: mat-font-weight($config, $level); |
36 |
| - $line-height: mat-line-height($config, $level); |
37 |
| - $font-family: mat-font-family($config, $level); |
38 |
| - |
| 32 | +// Outputs the shorthand `font` CSS property, based on a set of typography values. Falls back to |
| 33 | +// the individual properties if a value that isn't allowed in the shorthand is passed in. |
| 34 | +@mixin mat-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family) { |
39 | 35 | // If any of the values are set to `inherit`, we can't use the shorthand
|
40 | 36 | // so we fall back to passing in the individual properties.
|
41 | 37 | @if ($font-size == inherit or
|
|
53 | 49 | font-family: $font-family;
|
54 | 50 | }
|
55 | 51 | @else {
|
56 |
| - // Otherwise use the shorthand `font` to represent a typography level, because it's the the |
57 |
| - // least amount of bytes. Note that we need to use interpolation for `font-size/line-height` |
58 |
| - // in order to prevent Sass from dividing the two values. |
| 52 | + // Otherwise use the shorthand `font`, because it's the least amount of bytes. Note |
| 53 | + // that we need to use interpolation for `font-size/line-height` in order to prevent |
| 54 | + // Sass from dividing the two values. |
59 | 55 | font: $font-weight #{$font-size}/#{$line-height} $font-family;
|
60 | 56 | }
|
61 | 57 | }
|
| 58 | + |
| 59 | +// Converts a typography level into CSS styles. |
| 60 | +@mixin mat-typography-level-to-styles($config, $level) { |
| 61 | + $font-size: mat-font-size($config, $level); |
| 62 | + $font-weight: mat-font-weight($config, $level); |
| 63 | + $line-height: mat-line-height($config, $level); |
| 64 | + $font-family: mat-font-family($config, $level); |
| 65 | + |
| 66 | + @include mat-typography-font-shorthand($font-size, $font-weight, $line-height, $font-family); |
| 67 | +} |
0 commit comments