diff --git a/apps/renderer/src/components/ui/modal/stacked/helper.tsx b/apps/renderer/src/components/ui/modal/stacked/helper.tsx index e6167e1b1..04659fc2b 100644 --- a/apps/renderer/src/components/ui/modal/stacked/helper.tsx +++ b/apps/renderer/src/components/ui/modal/stacked/helper.tsx @@ -1,3 +1,4 @@ +import type { Enable } from "re-resizable" import type { Context, PropsWithChildren } from "react" import { memo, useContext } from "react" @@ -7,3 +8,21 @@ export const InjectContext = (context: Context) => { {children} )) } + +export function resizableOnly(...positions: (keyof Enable)[]) { + const enable: Enable = { + top: false, + right: false, + bottom: false, + left: false, + topRight: false, + bottomRight: false, + bottomLeft: false, + topLeft: false, + } + + for (const position of positions) { + enable[position] = true + } + return enable +} diff --git a/apps/renderer/src/components/ui/modal/stacked/modal.tsx b/apps/renderer/src/components/ui/modal/stacked/modal.tsx index dfad4edb2..8bfcbe70b 100644 --- a/apps/renderer/src/components/ui/modal/stacked/modal.tsx +++ b/apps/renderer/src/components/ui/modal/stacked/modal.tsx @@ -24,6 +24,7 @@ import { AppErrorBoundary } from "~/components/common/AppErrorBoundary" import { SafeFragment } from "~/components/common/Fragment" import { m } from "~/components/common/Motion" import { ErrorComponentType } from "~/components/errors/enum" +import { resizableOnly } from "~/components/ui/modal" import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT, isElectronBuild } from "~/constants" import { useSwitchHotKeyScope } from "~/hooks/common" import { nextFrame, stopPropagation } from "~/lib/dom" @@ -358,9 +359,7 @@ export const ModalInternal = memo( }} >