-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge: useSwitch 스타일링방식 vanilla-extract로 변경/README 업데이트 (#23)
merge: useSwitch 스타일링방식 vanilla-extract로 변경/README 업데이트 (#23)
- Loading branch information
Showing
5 changed files
with
92 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { ComplexStyleRule, style } from '@vanilla-extract/css'; | ||
|
||
/* The switch - the box around the slider */ | ||
export const switchLabel = style({ | ||
position: 'relative', | ||
display: 'inline-block', | ||
width: 60, | ||
height: 34, | ||
}); | ||
|
||
export const switchCirble: ComplexStyleRule = { | ||
position: 'absolute', | ||
content: '', | ||
height: 26, | ||
width: 26, | ||
left: 4, | ||
bottom: 4, | ||
backgroundColor: 'white', | ||
WebkitTransition: '.4s', | ||
transition: '.4s', | ||
}; | ||
|
||
/* Hide default HTML checkbox */ | ||
export const switchInput = style({ | ||
opacity: 0, | ||
width: 0, | ||
height: 0, | ||
}); | ||
|
||
/* The slider */ | ||
export const baseSlider = style({ | ||
position: 'absolute', | ||
cursor: 'pointer', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
backgroundColor: '#ccc', | ||
WebkitTransition: '.4s', | ||
transition: '.4s', | ||
'::before': { | ||
...switchCirble, | ||
}, | ||
}); | ||
|
||
export const checkedSlider = style({ | ||
backgroundColor: '#2196F3', | ||
position: 'absolute', | ||
cursor: 'pointer', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
'::before': { | ||
...switchCirble, | ||
transform: 'translateX(26px)', | ||
WebkitTransform: 'translateX(26px)', | ||
msTransform: 'translateX(26px)', | ||
}, | ||
}); | ||
|
||
/* Rounded sliders */ | ||
export const round = style({ | ||
borderRadius: 34, | ||
'::before': { | ||
borderRadius: '50%', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters