diff --git a/src/components/Integrations/Add/steps/MissionControlRegistryOptions.tsx b/src/components/Integrations/Add/steps/MissionControlRegistryOptions.tsx index ede18a30d7..4b7cb7ce2d 100644 --- a/src/components/Integrations/Add/steps/MissionControlRegistryOptions.tsx +++ b/src/components/Integrations/Add/steps/MissionControlRegistryOptions.tsx @@ -34,7 +34,7 @@ export default function MissionControlRegistryOptions({ onBack, selectedOption, footerClassName = "bg-gray-100 p-4", - onSuccess = () => { } + onSuccess = () => {} }: TopologyResourceFormProps) { const { height } = useWindowSize(); var lines = 6; @@ -47,8 +47,11 @@ export default function MissionControlRegistryOptions({ -
{selectedOption.dependencies && selectedOption.dependencies.length > 0 && ( - + )} - void; -} +}; export function useModal() { - return useContext(ModalContext) + return useContext(ModalContext); } export const ModalContext = createContext(undefined!); @@ -50,34 +56,37 @@ export interface IModalProps { export function useDialogSize(size?: string) { const { height, width } = useWindowSize(); - return useMemo(() => clsx( - size === 'full' && { - 'min-w-[1240px] w-[1240px]': width >= 1280, - 'w-[1000px]': width < 1280 && width >= 1024, - 'w-[90vw]': width < 1024 && width >= 768, - 'w-[95vw]': width < 768, - 'h-[90vh]': height < 1000, - 'h-[1000px]': height > 1000, - }, - size === 'small' && 'max-w-[800px] max-h-[50vh]', - size === 'medium' && { - 'w-[1000px]': width >= 1280, - 'w-[850px]': width < 1280 && width >= 1024, - 'w-[500vw]': width < 1024 && width >= 768, - 'w-[95vw]': width < 768, - 'h-[70vh]': height < 1000, - 'h-[800px]': height > 1000, - }, - size === 'large' && { - 'min-w-[1240px] w-[1240px]': width >= 1280, - 'w-[1000px]': width < 1280 && width >= 1024, - 'w-[600px]': width < 1024 && width >= 768, - 'w-[95vw]': width < 768, - 'h-[80vh]': height < 1000, - 'h-[1000px]': height > 1000, - - }, - ), [height, width, size]); + return useMemo( + () => + clsx( + size === "full" && { + "min-w-[1240px] w-[1240px]": width >= 1280, + "w-[1000px]": width < 1280 && width >= 1024, + "w-[90vw]": width < 1024 && width >= 768, + "w-[95vw]": width < 768, + "h-[90vh]": height < 1000, + "h-[1000px]": height > 1000 + }, + size === "small" && "max-w-[800px] max-h-[50vh]", + size === "medium" && { + "w-[1000px]": width >= 1280, + "w-[850px]": width < 1280 && width >= 1024, + "w-[500vw]": width < 1024 && width >= 768, + "w-[95vw]": width < 768, + "h-[70vh]": height < 1000, + "h-[800px]": height > 1000 + }, + size === "large" && { + "min-w-[1240px] w-[1240px]": width >= 1280, + "w-[1000px]": width < 1280 && width >= 1024, + "w-[600px]": width < 1024 && width >= 768, + "w-[95vw]": width < 768, + "h-[80vh]": height < 1000, + "h-[1000px]": height > 1000 + } + ), + [height, width, size] + ); } export function Modal({ @@ -88,9 +97,9 @@ export function Modal({ footerClassName = "flex my-2 px-8 justify-end", actions, open, - onClose = () => { }, - childClassName, - allowBackgroundClose, + onClose = () => {}, + childClassName = "w-full h-full", + allowBackgroundClose = true, hideCloseButton, size, children, @@ -100,7 +109,7 @@ export function Modal({ }: IModalProps) { const [helpLink] = useAtom(modalHelpLinkAtom); const [_size, setSize] = useState(size); - const sizeClass = useDialogSize(size); + const sizeClass = useDialogSize(_size); return ( @@ -108,11 +117,15 @@ export function Modal({ as="div" auto-reopen="true" className={dialogClassName} - onClose={allowBackgroundClose ? () => onClose() : () => { }} + onClose={allowBackgroundClose ? () => onClose() : () => {}} {...rest} >
+ className={clsx( + "flex items-center justify-center mx-auto my-auto", + sizeClass + )} + > {/* @ts-ignore */} -

} - {showExpand && _size !== 'full' && size !== 'small' && - setSize('full')} />} - - - {showExpand && _size === 'full' && setSize('medium')} />} - - + {showExpand && _size !== "full" && size !== "small" && ( + setSize("full")} + /> + )} + + {showExpand && _size === "full" && ( + setSize("medium")} + /> + )} {/* top-right close button */} - {!hideCloseButton && } + {!hideCloseButton && ( + + )}

-
+
{children}