mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
retrieve toast params from function getToastParams
This commit is contained in:
parent
a85b3147ce
commit
cfca580d74
1 changed files with 10 additions and 10 deletions
|
@ -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>
|
||||||
|
|
Loading…
Add table
Reference in a new issue