Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 50 additions & 7 deletions src/components/Slider/Slider.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
@use '../../styles/index' as s;
@use 'sass:map';

@mixin slider-thumb($width, $height) {
width: $width;
height: $height;
border: 2px solid s.color(black);
background: s.color(white) url('../../assets/paper.png');
background-size: cover;
cursor: pointer;
border-radius: 0;
transition: all 0.15s ease-in-out;
&:hover {
background: s.color(yellow-600) url('../../assets/paper.png');
transform: scale(1.1);
}
}

.slider {
@include s.flex-box(default, center, row);
gap: 12px;
Expand All @@ -11,31 +26,59 @@
appearance: none;
width: 200px;
height: 8px;
border: 2px solid s.color(black);
border-radius: 0;
background-size: cover;
cursor: pointer;

&::-webkit-slider-thumb,
&::-moz-range-thumb {
width: 18px;
height: 18px;
// 트랙 (크롬/사파리)
&::-webkit-slider-runnable-track {
height: 8px;
border: 2px solid s.color(black);
background: s.color(white) url('../../assets/paper.png');
background-size: cover;
}

// 트랙 (파이어폭스)
&::-moz-range-track {
height: 8px;
border: 2px solid s.color(black);
background: s.color(white) url('../../assets/paper.png');
background-size: cover;
}
Comment on lines +34 to +47

Choose a reason for hiding this comment

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

medium

::-webkit-slider-runnable-track::-moz-range-track의 스타일이 동일합니다. 코드 중복을 줄이고 유지보수성을 높이기 위해 SCSS 믹스인(mixin)을 활용하는 것을 고려해 보세요.

예시:

@mixin slider-track-styles {
  height: 8px;
  border: 2px solid s.color(black);
  background: s.color(white) url('../../assets/paper.png');
  background-size: cover;
}

.slider__input {
  // ...
  &::-webkit-slider-runnable-track {
    @include slider-track-styles;
  }

  &::-moz-range-track {
    @include slider-track-styles;
  }
}


// 손잡이
&::-webkit-slider-thumb {
-webkit-appearance: none;
margin-top: -8px;

width: 20px;
height: 20px;
border: 2px solid s.color(black);
background: s.color(white) url('../../assets/paper.png');
background-size: cover;
cursor: pointer;
transition: all 0.15s ease-in-out;
border-radius: 0;

&:hover {
background: s.color(yellow-600) url('../../assets/paper.png');
transform: scale(1.1);
}
}

&::-moz-range-track {
height: 10px;
&::-moz-range-thumb {
width: 20px;
height: 20px;
border: 2px solid s.color(black);
background: s.color(white) url('../../assets/paper.png');
background-size: cover;
cursor: pointer;
border-radius: 0;
Copy link

Copilot AI Sep 20, 2025

Choose a reason for hiding this comment

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

The Firefox thumb selector is missing the hover state and transition properties that are defined for the webkit version. This creates inconsistent behavior across browsers.

Suggested change
border-radius: 0;
border-radius: 0;
transition: all 0.15s ease-in-out;
&:hover {
background: s.color(yellow-600) url('../../assets/paper.png');
transform: scale(1.1);
}

Copilot uses AI. Check for mistakes.
transition: all 0.15s ease-in-out;
&:hover {
background: s.color(yellow-600) url('../../assets/paper.png');
transform: scale(1.1);
}
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/components/Switch/Switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ $thumb-checked-left: $switch-width - $thumb-size - $thumb-padding;
top: $thumb-padding;
width: $thumb-size;
height: $thumb-size;
background: s.color(red-300);
transition: left 0.3s;
background: s.color(gray-500);
transition:
left 0.3s ease,
background-color 0.3s ease;
box-shadow: 0 1px 4px s.color(gray-400);
}
}

.switch__input:checked + .switch__slider::before {
left: $thumb-checked-left;
background: s.color(red-300);
}

.switch__label {
Expand Down