Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

feat: Require use of a preset dialog size; adjust dialog sizing (#2684)

Jed Fox3b0fb1562d58
diff --git a/src/components/Dialog.tsx b/src/components/Dialog.tsx
index 90c3d030dd..4efbadb82f 100644
--- a/src/components/Dialog.tsx
+++ b/src/components/Dialog.tsx
@@ -19,7 +19,7 @@ const useRefState = <T,>() => {
export const Dialog = (props: {
children: React.ReactNode;
className?: string;
- maxWidth?: number;
+ small?: boolean;
onCloseRequest(): void;
title: React.ReactNode;
autofocus?: boolean;
@@ -76,7 +76,7 @@ export const Dialog = (props: {
<Modal
className={clsx("Dialog", props.className)}
labelledBy="dialog-title"
- maxWidth={props.maxWidth}
+ maxWidth={props.small ? 550 : 800}
onCloseRequest={props.onCloseRequest}
>
<Island padding={4} ref={setIslandNode}>
diff --git a/src/components/ErrorDialog.tsx b/src/components/ErrorDialog.tsx
index f10c718971..fbd8e48cf6 100644
--- a/src/components/ErrorDialog.tsx
+++ b/src/components/ErrorDialog.tsx
@@ -24,7 +24,7 @@ export const ErrorDialog = ({
<>
{modalIsShown && (
<Dialog
- maxWidth={500}
+ small
onCloseRequest={handleClose}
title={t("errorDialog.title")}
>
diff --git a/src/components/ExportDialog.tsx b/src/components/ExportDialog.tsx
index 013bbed33d..4abae75520 100644
--- a/src/components/ExportDialog.tsx
+++ b/src/components/ExportDialog.tsx
@@ -262,11 +262,7 @@ export const ExportDialog = ({
ref={triggerButton}
/>
{modalIsShown && (
- <Dialog
- maxWidth={800}
- onCloseRequest={handleClose}
- title={t("buttons.export")}
- >
+ <Dialog onCloseRequest={handleClose} title={t("buttons.export")}>
<ExportModal
elements={elements}
appState={appState}
diff --git a/src/components/PasteChartDialog.tsx b/src/components/PasteChartDialog.tsx
index 3c1aeadef3..22381d8a44 100644
--- a/src/components/PasteChartDialog.tsx
+++ b/src/components/PasteChartDialog.tsx
@@ -97,7 +97,7 @@ export const PasteChartDialog = ({
return (
<Dialog
- maxWidth={500}
+ small
onCloseRequest={handleClose}
title={t("labels.pasteCharts")}
className={"PasteChartDialog"}
diff --git a/src/components/ShortcutsDialog.tsx b/src/components/ShortcutsDialog.tsx
index 2e58a1ea2b..1fc877656e 100644
--- a/src/components/ShortcutsDialog.tsx
+++ b/src/components/ShortcutsDialog.tsx
@@ -130,11 +130,7 @@ export const ShortcutsDialog = ({ onClose }: { onClose?: () => void }) => {
return (
<>
- <Dialog
- maxWidth={900}
- onCloseRequest={handleClose}
- title={t("shortcutsDialog.title")}
- >
+ <Dialog onCloseRequest={handleClose} title={t("shortcutsDialog.title")}>
<Columns>
<Column>
<ShortcutIsland caption={t("shortcutsDialog.shapes")}>
diff --git a/src/excalidraw-app/collab/RoomDialog.tsx b/src/excalidraw-app/collab/RoomDialog.tsx
index afe8ef2434..fdf62f1c0c 100644
--- a/src/excalidraw-app/collab/RoomDialog.tsx
+++ b/src/excalidraw-app/collab/RoomDialog.tsx
@@ -123,11 +123,7 @@ const RoomDialog = ({
);
};
return (
- <Dialog
- maxWidth={800}
- onCloseRequest={handleClose}
- title={t("labels.createRoom")}
- >
+ <Dialog small onCloseRequest={handleClose} title={t("labels.createRoom")}>
{renderRoomDialog()}
</Dialog>
);