-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
130 lines (127 loc) · 3.87 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const plugin = require("tailwindcss/plugin")
module.exports = plugin(
({ addComponents, addBase }) => {
// 베이스스타일로 추가하기
addBase({
':root': {
// 스크롤바 배경색은 없는 것으로 추가하기
// '--tw-mac-scrollbar-bg': '255, 255, 255',
'--tw-mac-scrollbar-text': '12,12,12',
'--tw-mac-scrollbar-size-w': '6.4px',
'--tw-mac-scrollbar-size-h': '6.4px',
},
'*': {
// 이 속성은 넣어야하는지 넣지 말아야하는지 고민중
boxSizing: 'border-box',
'&::-webkit-scrollbar': {
backgroundColor: 'transparent',
width: 'var(--tw-mac-scrollbar-size-w, 6.4px)',
height: 'var(--tw-mac-scrollbar-size-h, 6.4px)'
},
'&::-webkit-scrollbar-track': {
backgroundColor: 'rgba(var(--tw-mac-scrollbar-bg), 0.6)',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'rgba(var(--tw-mac-scrollbar-text), 0.6)',
borderRadius: '999px'
}
},
'@media (prefers-color-scheme: dark)': {
':root': {
// '--tw-mac-scrollbar-bg': '255, 255, 255',
'--tw-mac-scrollbar-text': '173, 186, 199',
},
},
})
// TODO:
// mac-scrollbar-[color]
// 추가할수있게 변경하기
addComponents({
'.mac-scrollbar': {
'&::-webkit-scrollbar': {
width: 'var(--tw-mac-scrollbar-size-w, 6.4px)',
height: 'var(--tw-mac-scrollbar-size-h, 6.4px)'
},
'&::-webkit-scrollbar, &::-webkit-scrollbar-thumb': {
overflow: 'visible',
borderRadius: '4px',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'rgba(0,0,0,.1)',
},
},
// 가로를 의도적으로 사용할때 애니메이션 추가
'.mac-scrollbar-y': {
position: 'relative',
overflowY: 'scroll',
'&::-webkit-scrollbar': {
width: 'var(--tw-mac-scrollbar-size-w, 6.4px)',
height: 'var(--tw-mac-scrollbar-size-h, 6.4px)'
},
'&::-webkit-scrollbar, &::-webkit-scrollbar-thumb': {
overflow: 'visible',
borderRadius: '4px',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'rgba(0,0,0,.1)',
},
'&::after': {
content: "''",
position: 'absolute',
backgroundColor: '#fff',
height: '100%',
top: '0',
right: '0',
width: '.4em',
transition: 'all .5s',
opacity: '1',
},
'&:hover::after': {
opacity: '0',
transition: 'all .5s',
}
},
// 가로를 의도적으로 사용할때 애니메이션 추가
'.mac-scrollbar-x': {
position: 'relative',
overflowX: 'auto',
'&::-webkit-scrollbar': {
width: 'var(--tw-mac-scrollbar-size-w, 6.4px)',
height: 'var(--tw-mac-scrollbar-size-h, 6.4px)'
},
'&::-webkit-scrollbar, &::-webkit-scrollbar-thumb': {
overflow: 'visible',
borderRadius: '4px',
},
'&::-webkit-scrollbar-thumb': {
backgroundColor: 'rgba(0,0,0,.1)',
},
'&::after': {
content: "''",
position: 'absolute',
backgroundColor: '#fff',
width: '100%',
bottom: '0',
left: '0',
height: '6.4px',
transition: 'all .5s',
opacity: '1',
},
'&:hover::after': {
opacity: '0',
transition: 'all .5s',
}
},
'.scrollbar-hidden': {
// /* For IE, Edge and Firefox */
'-ms-overflow-style': 'none',
'scrollbar-width': 'none',
'&::-webkit-scrollbar': {
/* For Webkit-based browsers (Chrome, Safari and Opera) */
display: 'none',
},
},
})
},
{},
)