2023-05-01 05:07:01 -05:00
|
|
|
import { MouseEventHandler, ReactNode } from "react";
|
2023-03-28 02:31:50 -05:00
|
|
|
import ClickAwayHandler from "@/components/ClickAwayHandler";
|
2023-05-01 05:07:01 -05:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
2023-03-28 02:31:50 -05:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
toggleModal: Function;
|
|
|
|
children: ReactNode;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function ({ toggleModal, children }: Props) {
|
|
|
|
return (
|
2023-05-01 05:07:01 -05:00
|
|
|
<div className="overflow-y-auto py-2 fixed top-0 bottom-0 right-0 left-0 bg-gray-500 bg-opacity-10 flex items-center fade-in z-30">
|
|
|
|
<ClickAwayHandler onClickOutside={toggleModal} className="w-fit m-auto">
|
2023-05-31 13:33:01 -05:00
|
|
|
<div className="slide-up relative border-sky-100 rounded-2xl border-solid border shadow-lg p-5 bg-white">
|
2023-05-01 05:07:01 -05:00
|
|
|
<div
|
|
|
|
onClick={toggleModal as MouseEventHandler<HTMLDivElement>}
|
2023-05-31 13:33:01 -05:00
|
|
|
className="absolute top-5 left-5 inline-flex rounded-md cursor-pointer hover:bg-slate-200 duration-100 p-2"
|
2023-05-01 05:07:01 -05:00
|
|
|
>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faChevronLeft}
|
2023-05-31 13:33:01 -05:00
|
|
|
className="w-4 h-4 text-gray-500"
|
2023-05-01 05:07:01 -05:00
|
|
|
/>
|
|
|
|
</div>
|
2023-03-28 02:31:50 -05:00
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</ClickAwayHandler>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|