fix(component): toast duration (#1732)

This commit is contained in:
Himself65 2023-03-28 14:58:51 -05:00 committed by GitHub
parent 6917d2100f
commit f18127dfd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -17,6 +17,9 @@ export const StyledSliderBar = styled('div')<{ show: boolean }>(
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
[theme.breakpoints.down('sm')]: {
position: 'absolute',
},
};
}
);

View File

@ -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;
};