Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(component): toast duration (#1732)

Himself65f18127dfd635
diff --git a/apps/web/src/components/pure/workspace-slider-bar/style.ts b/apps/web/src/components/pure/workspace-slider-bar/style.ts
index 0089610dce..6f564d7b18 100644
--- a/apps/web/src/components/pure/workspace-slider-bar/style.ts
+++ b/apps/web/src/components/pure/workspace-slider-bar/style.ts
@@ -17,6 +17,9 @@ export const StyledSliderBar = styled('div')<{ show: boolean }>(
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
+ [theme.breakpoints.down('sm')]: {
+ position: 'absolute',
+ },
};
}
);
diff --git a/packages/component/src/ui/toast/toast.ts b/packages/component/src/ui/toast/toast.ts
index 3934870490..19696bf8aa 100644
--- a/packages/component/src/ui/toast/toast.ts
+++ b/packages/component/src/ui/toast/toast.ts
@@ -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;
};