-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawer.scss
More file actions
121 lines (103 loc) · 2.47 KB
/
drawer.scss
File metadata and controls
121 lines (103 loc) · 2.47 KB
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
/**
* @file drawer.scss
* @component Drawer
* @category Organisms
* @description A versatile off-canvas container that slides in from various positions
* or fades into the center. Used for mobile menus, filters, or modal dialogs.
*
* @section Variables
* --duration : Transition speed for all animations (visibility, opacity, transform).
* --bg : The background color of the inner container, theme-aware.
*
* @section Attributes and Modifiers
* [open] - Toggles visibility and triggers entry animations.
* .drawer--left - Slides the drawer in from the left edge.
* .drawer--right - Slides the drawer in from the right edge.
* .drawer--center - Fades/scales the drawer as a centered modal.
*/
.drawer {
$root: &;
--duration: 0.3s;
--bg: var(--color-surface, #fff);
[data-theme="dark"] & {
--bg: var(--color-neutral-80, #222);
}
position: fixed;
inset: 0;
z-index: 1000;
visibility: hidden;
transition: visibility var(--duration);
&[open] {
visibility: visible;
}
&__overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.5);
opacity: 0;
transition: opacity var(--duration);
#{$root}[open] & {
opacity: 1;
}
}
&__inner {
position: absolute;
background: var(--bg);
display: flex;
flex-direction: column;
transition: transform var(--duration) ease-in-out, opacity var(--duration);
max-width: var(--drawer-max-width, 60rem);
width: 100%;
height: 100%;
margin: 0 auto;
#{$root}--right & {
right: 0;
transform: translateX(100%);
}
#{$root}--left & {
left: 0;
transform: translateX(-100%);
}
#{$root}--center & {
top: 50%;
left: 50%;
height: auto;
max-height: 90vh;
transform: translate(-50%, -40%) scale(0.95);
border-radius: 8px;
opacity: 0;
}
#{$root}[open]#{$root}--right &,
#{$root}[open]#{$root}--left & {
transform: translateX(0);
}
#{$root}[open]#{$root}--center & {
transform: translate(-50%, -50%) scale(1);
opacity: 1;
}
}
&__header {
padding: 1rem;
border-bottom: 1px solid #e5e5e5;
display: flex;
justify-content: space-between;
align-items: center;
}
&__body {
padding: 1rem;
overflow-y: auto;
flex-grow: 1;
}
&__footer {
padding: 1rem;
}
&__title {
margin: 0;
font-size: 1.25rem;
line-height: 1em;
font-weight: 600;
}
&__close {
padding: 0;
}
}