* chore(repo): migrate to pnpm * chore(repo): cleanup pnpm integration with turbo * chore(repo): run lint * chore(repo): cleanup tsconfigs * chore: align TypeScript to 5.8.3 across monorepo; update pnpm override and catalog; pnpm install to update lockfile * chore(repo): revert logger.ts changes * fix: type errors * fix: build errors * fix: pnpm home setup in dockerfiles --------- Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
import { Dialog, Transition } from "@headlessui/react";
|
|
import React, { Fragment } from "react";
|
|
// constants
|
|
import { cn } from "../utils";
|
|
import { EModalPosition, EModalWidth } from "./constants";
|
|
// helpers
|
|
|
|
type Props = {
|
|
children: React.ReactNode;
|
|
handleClose?: () => void;
|
|
isOpen: boolean;
|
|
position?: EModalPosition;
|
|
width?: EModalWidth;
|
|
className?: string;
|
|
};
|
|
export const ModalCore: React.FC<Props> = (props) => {
|
|
const {
|
|
children,
|
|
handleClose,
|
|
isOpen,
|
|
position = EModalPosition.CENTER,
|
|
width = EModalWidth.XXL,
|
|
className = "",
|
|
} = props;
|
|
|
|
return (
|
|
<Transition.Root show={isOpen} as={Fragment}>
|
|
<Dialog as="div" className="relative z-30" onClose={() => handleClose && handleClose()}>
|
|
<Transition.Child
|
|
as={Fragment}
|
|
enter="ease-out duration-300"
|
|
enterFrom="opacity-0"
|
|
enterTo="opacity-100"
|
|
leave="ease-in duration-200"
|
|
leaveFrom="opacity-100"
|
|
leaveTo="opacity-0"
|
|
>
|
|
<div className="fixed inset-0 bg-custom-backdrop transition-opacity" />
|
|
</Transition.Child>
|
|
|
|
<div className="fixed inset-0 z-30 overflow-y-auto">
|
|
<div className={position}>
|
|
<Transition.Child
|
|
as={Fragment}
|
|
enter="ease-out duration-300"
|
|
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
enterTo="opacity-100 translate-y-0 sm:scale-100"
|
|
leave="ease-in duration-200"
|
|
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
|
|
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
>
|
|
<Dialog.Panel
|
|
className={cn(
|
|
"relative transform rounded-lg bg-custom-background-100 text-left shadow-custom-shadow-md transition-all w-full",
|
|
width,
|
|
className
|
|
)}
|
|
>
|
|
{children}
|
|
</Dialog.Panel>
|
|
</Transition.Child>
|
|
</div>
|
|
</div>
|
|
</Dialog>
|
|
</Transition.Root>
|
|
);
|
|
};
|