Skip to content

Commit

Permalink
Use scss vars in ThemeToggle (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
echang594 authored Jan 23, 2024
1 parent 2484444 commit 3b0f64e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/components/common/ThemeToggle/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'src/styles/vars.scss' as vars;

$indicator-size: 30px;
$switch-gap: 127%;
$switch-gap-num: calc($switch-gap / 100%);
Expand All @@ -6,8 +8,8 @@ $component-roundness: 34px;

.switch {
align-items: center;
border-color: #9f9f9f;
border-radius: 34px;
border-color: var(--theme-mode-indicator);
border-radius: $component-roundness;
border-style: solid;
border-width: 1px;
display: flex;
Expand All @@ -16,14 +18,13 @@ $component-roundness: 34px;

label {
align-items: center;
color: #fff;
cursor: pointer;
display: flex;
flex-direction: row;
float: left;
height: $indicator-size * 1.2;
height: $indicator-size * $switch-gap-num;
justify-content: center;
width: #{$indicator-size * $switch-gap-num};
width: $indicator-size * $switch-gap-num;

input {
opacity: 0;
Expand Down Expand Up @@ -60,29 +61,28 @@ $component-roundness: 34px;

.icon {
align-items: center;
color: #fff;
display: flex;

fill: var(--theme-mode-icon);
height: $indicator-size;
justify-content: center;
padding: #{$indicator-size * 0.25};
padding: $indicator-size * 0.25;
position: absolute;
stroke: var(--theme-mode-icon);
width: $indicator-size;
z-index: 2;
}

.switchOne {
transform: translate3d(#{$switch-start}, 0, 0);
transform: translate3d($switch-start, 0, 0);
}

.switchTwo {
transform: translate3d(calc(#{$switch-start} + #{$switch-gap}), 0, 0);
transform: translate3d(calc($switch-start + $switch-gap), 0, 0);
}

.switchThree {
transform: translate3d(calc(#{$switch-start} + #{$switch-gap * 2}), 0, 0);
transform: translate3d(calc($switch-start + $switch-gap * 2), 0, 0);
}
}

Expand Down

1 comment on commit 3b0f64e

@vercel
Copy link

@vercel vercel bot commented on 3b0f64e Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.