|
60 | 60 | );
|
61 | 61 | }
|
62 | 62 |
|
63 |
| -/// This mixin should normally be used with the `rmd-elevation` mixin to change |
64 |
| -/// the background color based on the current elevation in dark themes. |
| 63 | +/// Conditionally adds styles only when the `$rmd-theme-dark-elevation` |
| 64 | +/// variable is set to `true`. This will also work with the |
| 65 | +/// `$rmd-theme-dark-class` variable to either set the styles with a media |
| 66 | +/// query or only when the dark class has been enabled on a parent element. |
65 | 67 | ///
|
66 |
| -/// @since 2.1.0 |
67 |
| -/// @param {Number} z-value - This should be a number between 0 and 24 |
68 |
| -/// representing the current elevation. |
| 68 | +/// @since 2.5.4 |
69 | 69 | /// @param {Boolean} css-modules [false] - Boolean if this is being used within
|
70 | 70 | /// CSS Modules which will update the selector to work correctly by wrapping
|
71 | 71 | /// different parts with `:global` and `:local`.
|
72 |
| -@mixin rmd-theme-dark-elevation($z-value, $css-modules: false) { |
| 72 | +@mixin rmd-theme-dark-elevation-styles($css-modules: false) { |
73 | 73 | @if $rmd-theme-dark-elevation {
|
74 | 74 | @if $rmd-theme-dark-class == 'prefers-color-scheme' {
|
75 | 75 | @media (prefers-color-scheme: dark) {
|
76 | 76 | & {
|
77 |
| - @include rmd-theme-update-var( |
78 |
| - background, |
79 |
| - map-get($rmd-theme-dark-elevation-colors, $z-value) |
80 |
| - ); |
81 |
| - @include rmd-theme(background-color, background); |
| 77 | + @content; |
82 | 78 | }
|
83 | 79 | }
|
84 | 80 | } @else {
|
85 | 81 | @include rmd-utils-optional-css-modules(
|
86 | 82 | $rmd-theme-dark-class,
|
87 | 83 | $css-modules
|
88 | 84 | ) {
|
89 |
| - @include rmd-theme-update-var( |
90 |
| - background, |
91 |
| - map-get($rmd-theme-dark-elevation-colors, $z-value) |
92 |
| - ); |
93 |
| - @include rmd-theme(background-color, background); |
| 85 | + @content; |
94 | 86 | }
|
95 | 87 | }
|
96 | 88 | }
|
97 | 89 | }
|
98 | 90 |
|
| 91 | +/// This mixin should normally be used with the `rmd-elevation` mixin to change |
| 92 | +/// the background color based on the current elevation in dark themes. |
| 93 | +/// |
| 94 | +/// @since 2.1.0 |
| 95 | +/// @param {Number} z-value - This should be a number between 0 and 24 |
| 96 | +/// representing the current elevation. |
| 97 | +/// @param {Boolean} css-modules [false] - Boolean if this is being used within |
| 98 | +/// CSS Modules which will update the selector to work correctly by wrapping |
| 99 | +/// different parts with `:global` and `:local`. |
| 100 | +@mixin rmd-theme-dark-elevation($z-value, $css-modules: false) { |
| 101 | + @include rmd-theme-dark-elevation-styles($css-modules) { |
| 102 | + @include rmd-theme-update-var( |
| 103 | + background, |
| 104 | + map-get($rmd-theme-dark-elevation-colors, $z-value) |
| 105 | + ); |
| 106 | + @include rmd-theme(background-color, background); |
| 107 | + } |
| 108 | +} |
| 109 | + |
99 | 110 | /// This mixin can be used to apply the light theme by updating **every** color
|
100 | 111 | /// theme variable across all react-md packages.
|
101 | 112 | ///
|
|
0 commit comments