fix: #1130 #1131 delete right session

This commit is contained in:
Yidadaa
2023-05-01 23:21:28 +08:00
parent 0209ace221
commit c37885e743
4 changed files with 58 additions and 58 deletions

View File

@@ -158,6 +158,7 @@ export type ToastProps = {
text: string;
onClick: () => void;
};
onClose?: () => void;
};
export function Toast(props: ToastProps) {
@@ -167,7 +168,10 @@ export function Toast(props: ToastProps) {
<span>{props.content}</span>
{props.action && (
<button
onClick={props.action.onClick}
onClick={() => {
props.action?.onClick?.();
props.onClose?.();
}}
className={styles["toast-action"]}
>
{props.action.text}
@@ -201,7 +205,7 @@ export function showToast(
close();
}, delay);
root.render(<Toast content={content} action={action} />);
root.render(<Toast content={content} action={action} onClose={close} />);
}
export type InputProps = React.HTMLProps<HTMLTextAreaElement> & {