Navigation Menu

Skip to content

Commit

Permalink
refactor(form): moved some toggle styles into separate mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Apr 21, 2021
1 parent adb6b06 commit 517f199
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions packages/form/src/toggle/_mixins.scss
Expand Up @@ -207,20 +207,41 @@
}
}

///
/// @access private
@mixin rmd-switch-ball-disabled {
@include rmd-states-theme-update-var(hover-color, transparent);

cursor: auto;

&::after {
@include rmd-form-theme(background-color, disabled-color);
}
}

///
/// @access private
@mixin rmd-switch-ball-checked {
$offset: $rmd-switch-ball-size + $rmd-switch-ball-offset;

@include rmd-utils-rtl {
transform: translateX(-$offset);
}
transform: translateX($offset);

&::after {
@include rmd-form-theme(background-color, active-color);
}
}

///
/// @access private
@mixin rmd-switch-input {
@include rmd-input-hidden;
@include rmd-states-focus-shadow('&:focus + .rmd-switch__ball');

&:disabled + .rmd-switch__ball {
@include rmd-states-theme-update-var(hover-color, transparent);

cursor: auto;

&::after {
@include rmd-form-theme(background-color, disabled-color);
}
@include rmd-switch-ball-disabled;
}

@include rmd-utils-keyboard-only {
Expand All @@ -247,16 +268,7 @@
}

&:checked + .rmd-switch__ball {
$offset: $rmd-switch-ball-size + $rmd-switch-ball-offset;

@include rmd-utils-rtl {
transform: translateX(-$offset);
}
transform: translateX($offset);

&::after {
@include rmd-form-theme(background-color, active-color);
}
@include rmd-switch-ball-checked;
}

&:checked:disabled + .rmd-switch__ball::after {
Expand Down

0 comments on commit 517f199

Please sign in to comment.