-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
drawer.css
56 lines (56 loc) · 1.47 KB
/
drawer.css
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
.drawer {
@apply relative grid;
grid-auto-columns: max-content auto;
&-content {
@apply col-start-2 row-start-1 min-w-0;
}
&-side {
@apply pointer-events-none fixed start-0 top-0 col-start-1 row-start-1 grid w-full grid-cols-1 grid-rows-1 items-start justify-items-start overflow-x-hidden overflow-y-hidden overscroll-contain;
height: 100vh;
height: 100dvh;
& > .drawer-overlay {
@apply sticky top-0 place-self-stretch;
}
& > * {
@apply col-start-1 row-start-1;
}
& > *:not(.drawer-overlay) {
@apply transition-transform duration-300 ease-out will-change-transform;
transform: translateX(-100%);
[dir="rtl"] & {
transform: translateX(100%);
}
}
}
&-toggle {
@apply fixed h-0 w-0 appearance-none opacity-0;
&:checked {
& ~ .drawer-side {
@apply pointer-events-auto visible overflow-y-auto;
& > *:not(.drawer-overlay) {
transform: translateX(0%);
}
}
}
}
&-end {
grid-auto-columns: auto max-content;
.drawer-toggle {
& ~ .drawer-content {
@apply col-start-1;
}
& ~ .drawer-side {
@apply col-start-2 justify-items-end;
}
& ~ .drawer-side > *:not(.drawer-overlay) {
transform: translateX(100%);
[dir="rtl"] & {
transform: translateX(-100%);
}
}
&:checked ~ .drawer-side > *:not(.drawer-overlay) {
transform: translateX(0%);
}
}
}
}