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() {
|
||||
const { zenModeEnabled, viewModeEnabled } = this.state;
|
||||
const selectedElement = getSelectedElements(
|
||||
|
@ -550,16 +559,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
/>
|
||||
)}
|
||||
{this.state.toastMessage !== null && (
|
||||
<Toast
|
||||
message={this.state.toastMessage}
|
||||
clearToast={this.clearToast}
|
||||
duration={
|
||||
this.state.toastMessage === t("alerts.browserZoom")
|
||||
? Infinity
|
||||
: undefined
|
||||
}
|
||||
closable={this.state.toastMessage === t("alerts.browserZoom")}
|
||||
/>
|
||||
<Toast {...this.getToastParams()} />
|
||||
)}
|
||||
<main>{this.renderCanvas()}</main>
|
||||
</DeviceContext.Provider>
|
||||
|
|
Loading…
Add table
Reference in a new issue