mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-12 11:59:58 +02:00
retrieve toast params from function getToastParams
This commit is contained in:
@@ -468,6 +468,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getToastParams = () => {
|
||||||
|
const isBrowserZoomed = this.state.toastMessage === t("alerts.browserZoom");
|
||||||
|
return {
|
||||||
|
message: this.state.toastMessage!,
|
||||||
|
duration: isBrowserZoomed ? Infinity : undefined,
|
||||||
|
closable: isBrowserZoomed,
|
||||||
|
clearToast: this.clearToast,
|
||||||
|
};
|
||||||
|
};
|
||||||
public render() {
|
public render() {
|
||||||
const { zenModeEnabled, viewModeEnabled } = this.state;
|
const { zenModeEnabled, viewModeEnabled } = this.state;
|
||||||
const selectedElement = getSelectedElements(
|
const selectedElement = getSelectedElements(
|
||||||
@@ -550,16 +559,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{this.state.toastMessage !== null && (
|
{this.state.toastMessage !== null && (
|
||||||
<Toast
|
<Toast {...this.getToastParams()} />
|
||||||
message={this.state.toastMessage}
|
|
||||||
clearToast={this.clearToast}
|
|
||||||
duration={
|
|
||||||
this.state.toastMessage === t("alerts.browserZoom")
|
|
||||||
? Infinity
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
closable={this.state.toastMessage === t("alerts.browserZoom")}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
<main>{this.renderCanvas()}</main>
|
<main>{this.renderCanvas()}</main>
|
||||||
</DeviceContext.Provider>
|
</DeviceContext.Provider>
|
||||||
|
Reference in New Issue
Block a user