Skip to content

Commit

Permalink
fix(component): StyledThumb border 수정
Browse files Browse the repository at this point in the history
* StyledThumb 컴포넌트에서 before, after를 사용하여 0.1px의 border를 나타냈습니다
  • Loading branch information
nijuy committed Oct 8, 2023
1 parent 730f0d8 commit af12adc
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/components/Toggle/Toggle.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TRACK_WIDTH = 51;
const TRACK_HEIGHT = 31;
const THUMB_SIZE = 27;
const PADDING = 2;
const MIN_WIDTH = 0.1;

const setTrackColor = ({
$isDisabled,
Expand All @@ -36,13 +37,32 @@ export const StyledThumb = styled.span<StyledToggleProps>`
display: inline-block;
width: ${THUMB_SIZE}px;
height: ${THUMB_SIZE}px;
border: ${({ theme }) => `0.1px solid ${theme.color.borderNormal}`};
border-radius: 50%;
background-color: ${({ theme, $isDisabled }) =>
$isDisabled ? theme.color.buttonDisabled : theme.color.buttonBright};
transform: ${({ $isSelected }) =>
$isSelected && `translateX(${TRACK_WIDTH - 2 * PADDING - THUMB_SIZE}px)`};
transition: 100ms ease-in-out;
&::before {
position: absolute;
content: '';
border-radius: inherit;
width: ${THUMB_SIZE + MIN_WIDTH}px;
height: ${THUMB_SIZE + MIN_WIDTH}px;
background-color: ${({ theme }) => theme.color.borderNormal};
}
&::after {
position: absolute;
content: '';
top: ${MIN_WIDTH}px;
left: ${MIN_WIDTH}px;
border-radius: inherit;
width: inherit;
height: inherit;
background-color: inherit;
}
`;

export const StyledTrack = styled.label<StyledToggleProps>`
Expand Down

0 comments on commit af12adc

Please sign in to comment.