Skip to content

Commit cf6b383

Browse files
committed
use --uui-toast-notification-animation-duration for transition duration
1 parent 9fbba96 commit cf6b383

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

packages/uui-toast-notification/lib/uui-toast-notification.element.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export class UUIToastNotificationElement extends LitElement {
3838
height: 0;
3939
pointer-events: none;
4040
41-
transition: height 480ms ease-in-out;
41+
transition: height
42+
var(--uui-toast-notification-animation-duration, 480ms) ease-in-out;
4243
}
4344
:host([is-open]) {
4445
pointer-events: all;
@@ -74,7 +75,8 @@ export class UUIToastNotificationElement extends LitElement {
7475
border-radius: calc(var(--uui-border-radius) * 2);
7576
7677
opacity: 0;
77-
transition: opacity 480ms;
78+
transition: opacity
79+
var(--uui-toast-notification-animation-duration, 480ms);
7880
}
7981
:host([is-open]) #toast > div {
8082
opacity: 1;
@@ -230,6 +232,17 @@ export class UUIToastNotificationElement extends LitElement {
230232
demandCustomElement(this, 'uui-icon');
231233
}
232234

235+
private _getAnimationDuration(): number {
236+
return (
237+
parseInt(
238+
getComputedStyle(this).getPropertyValue(
239+
'--uui-toast-notification-animation-duration'
240+
),
241+
10
242+
) || 480
243+
);
244+
}
245+
233246
private _requestAnimationUpdate = 0;
234247
private _makeOpen() {
235248
if (this._open === true) {
@@ -265,7 +278,7 @@ export class UUIToastNotificationElement extends LitElement {
265278
new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENED)
266279
);
267280
}
268-
}, 480);
281+
}, this._getAnimationDuration());
269282
});
270283
});
271284
}
@@ -312,7 +325,7 @@ export class UUIToastNotificationElement extends LitElement {
312325
this.parentNode.removeChild(this);
313326
}
314327
}
315-
}, 480);
328+
}, this._getAnimationDuration());
316329
});
317330
}
318331
}

0 commit comments

Comments
 (0)