Skip to content

Commit e62acb1

Browse files
authored
fix: revert modal transition back to animation (#4805)
1 parent c2a662e commit e62acb1

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

packages/ui/src/lib/Modal.svelte

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
<dialog
3838
bind:this={dialogElement}
39-
class="modal-content"
39+
class="modal-container"
4040
class:default={width === 'default'}
4141
class:large={width === 'large'}
4242
class:small={width === 'small'}
@@ -80,42 +80,39 @@
8080
dialog {
8181
display: none;
8282
outline: none;
83-
transform: scale(0.95);
84-
transition: transform 250ms cubic-bezier(0.34, 1.35, 0.7, 1);
85-
}
86-
87-
dialog::backdrop {
88-
transition: opacity 150ms ease-in;
89-
background-color: rgb(0 0 0 / 0%);
9083
}
9184
9285
dialog[open] {
9386
display: flex;
94-
transform: scale(1);
9587
}
9688
9789
dialog[open]::backdrop {
98-
background-color: var(--clr-overlay-bg);
99-
opacity: 1;
90+
/* NOTE: temporarily hardcoded var(--clr-overlay-bg); */
91+
background-color: color(srgb 0 0 0 / 0.34901960784313724);
10092
}
10193
102-
@starting-style {
103-
dialog[open] {
104-
transform: scale(0.95);
105-
}
106-
dialog[open]::backdrop {
107-
opacity: 0;
108-
}
94+
html.dark dialog[open]::backdrop {
95+
/* NOTE: temporarily hardcoded dark var(--clr-overlay-bg); */
96+
background-color: color(srgb 0.8392156862745098 0.8392156862745098 0.8392156862745098 / 0.4);
10997
}
11098
111-
.modal-content {
99+
.modal-container[open]::backdrop {
100+
animation: dialog-fade 0.15s ease-in;
101+
}
102+
103+
.modal-container[open] {
104+
animation: dialog-zoom 0.25s cubic-bezier(0.34, 1.35, 0.7, 1);
105+
}
106+
107+
.modal-container {
112108
flex-direction: column;
113109
114110
max-height: calc(100vh - 80px);
115111
border-radius: var(--radius-l);
116112
background-color: var(--clr-bg-1);
117113
box-shadow: var(--fx-shadow-l);
118114
}
115+
119116
dialog[open] {
120117
border: 1px solid var(--clr-border-2);
121118
}
@@ -148,20 +145,38 @@
148145
background-color: var(--clr-bg-1);
149146
}
150147
148+
@keyframes dialog-zoom {
149+
from {
150+
transform: scale(0.95);
151+
}
152+
to {
153+
transform: scale(1);
154+
}
155+
}
156+
157+
@keyframes dialog-fade {
158+
from {
159+
opacity: 0;
160+
}
161+
to {
162+
opacity: 1;
163+
}
164+
}
165+
151166
/* MODIFIERS */
152-
.modal-content.default {
167+
.modal-container.default {
153168
width: 580px;
154169
}
155170
156-
.modal-content.large {
171+
.modal-container.large {
157172
width: 840px;
158173
}
159174
160-
.modal-content.small {
175+
.modal-container.small {
161176
width: 380px;
162177
}
163178
164-
.modal-content.xsmall {
179+
.modal-container.xsmall {
165180
width: 310px;
166181
}
167182
</style>

0 commit comments

Comments
 (0)