|
26 | 26 | $font-family: _mat-get-type-value($config, $level, font-family);
|
27 | 27 | }
|
28 | 28 |
|
29 |
| - @return unquote($font-family); |
| 29 | + @return if($font-family == null, $font-family, unquote($font-family)); |
30 | 30 | }
|
31 | 31 |
|
32 | 32 | // Converts a typography level into CSS styles.
|
|
36 | 36 | $line-height: mat-line-height($config, $level);
|
37 | 37 | $font-family: mat-font-family($config, $level);
|
38 | 38 |
|
39 |
| - // Use the shorthand `font` to represent a typography level, because it's the shortest. Notes that |
40 |
| - // we need to use interpolation for `font-size/line-height` in order to prevent SASS from dividing |
41 |
| - // the two values. |
42 |
| - font: $font-weight #{$font-size}/#{$line-height} $font-family; |
| 39 | + // If any of the values are set to `inherit`, we can't use the shorthand |
| 40 | + // so we fall back to passing in the individual properties. |
| 41 | + @if ($font-size == inherit or |
| 42 | + $font-weight == inherit or |
| 43 | + $line-height == inherit or |
| 44 | + $font-family == inherit or |
| 45 | + $font-size == null or |
| 46 | + $font-weight == null or |
| 47 | + $line-height == null or |
| 48 | + $font-family == null) { |
| 49 | + |
| 50 | + font-size: $font-size; |
| 51 | + font-weight: $font-weight; |
| 52 | + line-height: $line-height; |
| 53 | + font-family: $font-family; |
| 54 | + } |
| 55 | + @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. |
| 59 | + font: $font-weight #{$font-size}/#{$line-height} $font-family; |
| 60 | + } |
43 | 61 | }
|
0 commit comments