feat: update toast api to account for duration and closable (#5427)
* feat: update toast api to account for duration and closable * fix * update snaps * update docs * male toast nullable * fix snaps * remove clearToast from App.tsx and replace clearToast prop in Toast comp with onClose
This commit is contained in:
@ -19,7 +19,7 @@ const getStorageSizes = debounce((cb: (sizes: StorageSizes) => void) => {
|
||||
}, STORAGE_SIZE_TIMEOUT);
|
||||
|
||||
type Props = {
|
||||
setToastMessage: (message: string) => void;
|
||||
setToast: (message: string) => void;
|
||||
};
|
||||
const CustomStats = (props: Props) => {
|
||||
const [storageSizes, setStorageSizes] = useState<StorageSizes>({
|
||||
@ -68,7 +68,7 @@ const CustomStats = (props: Props) => {
|
||||
onClick={async () => {
|
||||
try {
|
||||
await copyTextToSystemClipboard(getVersion());
|
||||
props.setToastMessage(t("toast.copyToClipboard"));
|
||||
props.setToast(t("toast.copyToClipboard"));
|
||||
} catch {}
|
||||
}}
|
||||
title={t("stats.versionCopy")}
|
||||
|
@ -658,7 +658,7 @@ const ExcalidrawWrapper = () => {
|
||||
const renderCustomStats = () => {
|
||||
return (
|
||||
<CustomStats
|
||||
setToastMessage={(message) => excalidrawAPI!.setToastMessage(message)}
|
||||
setToast={(message) => excalidrawAPI!.setToast({ message })}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user