fix(component): toast duration (#1732)
This commit is contained in:
@@ -17,6 +17,9 @@ export const StyledSliderBar = styled('div')<{ show: boolean }>(
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
|
[theme.breakpoints.down('sm')]: {
|
||||||
|
position: 'absolute',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export type ToastOptions = {
|
|||||||
*/
|
*/
|
||||||
export const toast = (
|
export const toast = (
|
||||||
message: string,
|
message: string,
|
||||||
{ duration, portal }: ToastOptions = {
|
{ duration = 2500, portal }: ToastOptions = {
|
||||||
duration: 2500,
|
duration: 2500,
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
@@ -107,8 +107,9 @@ export const toast = (
|
|||||||
element.style.margin = '0';
|
element.style.margin = '0';
|
||||||
element.style.padding = '0';
|
element.style.padding = '0';
|
||||||
// wait for transition
|
// wait for transition
|
||||||
await sleep(230);
|
element.addEventListener('transitionend', () => {
|
||||||
element.remove();
|
element.remove();
|
||||||
|
});
|
||||||
}, duration);
|
}, duration);
|
||||||
return element;
|
return element;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user