mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-28 09:14:57 +03:00
fix(component): toast duration (#1732)
This commit is contained in:
parent
6917d2100f
commit
f18127dfd6
@ -17,6 +17,9 @@ export const StyledSliderBar = styled('div')<{ show: boolean }>(
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
overflow: 'hidden',
|
||||
[theme.breakpoints.down('sm')]: {
|
||||
position: 'absolute',
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ export type ToastOptions = {
|
||||
*/
|
||||
export const toast = (
|
||||
message: string,
|
||||
{ duration, portal }: ToastOptions = {
|
||||
{ duration = 2500, portal }: ToastOptions = {
|
||||
duration: 2500,
|
||||
}
|
||||
) => {
|
||||
@ -107,8 +107,9 @@ export const toast = (
|
||||
element.style.margin = '0';
|
||||
element.style.padding = '0';
|
||||
// wait for transition
|
||||
await sleep(230);
|
||||
element.remove();
|
||||
element.addEventListener('transitionend', () => {
|
||||
element.remove();
|
||||
});
|
||||
}, duration);
|
||||
return element;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user