Skip to content

Commit

Permalink
refactor(dark-mode-class): rewrite of the mixin
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the complete dark-mode-class mixin api has changes (see docs)
  • Loading branch information
felix-berlin committed Jan 7, 2024
1 parent d958ca7 commit 49f2a29
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mixins/_dark-mode-class.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/// Use a predefined dark mode class to define dark mode styles.
/// @param {String} $element ['html']
/// @param {String} $class ['dark']
/// @param {Boolean} $parent [true] - If true, the dark mode class will be root
/// @param {String} $class ['dark'] - The dark mode class, could be any selector
/// @group @media
/// @author Felix Scholze
/// @since v1.10.0
///
/// @example
/// .button {
/// @include dark-mode-class('body', 'dark-mode') {
/// @include dark-mode-class('body.dark-mode') {
/// color: #fff;
/// }
/// }
///
/// @example CSS - Output CSS
/// body[class~=dark-mode] .button {
/// @output
/// body.dark-mode .button {
/// color: #fff;
/// }
///
@mixin dark-mode-class($element: 'html', $parent: true, $class: 'dark') {
@mixin dark-mode-class($parent: true, $class: '.dark') {
@if $parent {
#{$element}[class~="#{$class}"] & {
#{$class} & {
@content;
}
} @else {
#{$element}[class~="#{$class}"] {
#{$class} {
@content;
}
}
Expand Down

0 comments on commit 49f2a29

Please sign in to comment.