diff --git a/src/components/modal/modal.tsx b/src/components/modal/modal.tsx index 8762407..0dd5b2c 100644 --- a/src/components/modal/modal.tsx +++ b/src/components/modal/modal.tsx @@ -1,83 +1,67 @@ +import { Dialog, Transition } from "@headlessui/react"; import { useToggle } from "@uidotdev/usehooks"; -import React from "react"; - import classNames from "classnames"; +import React, { Fragment } from "react"; import { Icon, IconIdentifier } from "../icon"; -import { ModalComponents, ModalProps } from "./type"; +import { ModalProps } from "./type"; -export const Modal: React.FC & ModalComponents = ({ +export const Modal: React.FC = ({ title, children, className, - size = "sm", + position = "top-right", ...rest }) => { // States. const [show, toggle] = useToggle(true); // Constants. - const customClassNames = classNames( - "relative my-6 mx-auto max-w-3xl", - className, - { - "w-3/12": size === "sm", - "w-6/12": size === "md", - "w-8/12": size === "lg", - } - ); + const customClassNames = classNames("flex p-2", className, { + "items-center justify-center h-full": position === "center", + "justify-center": position === "top-center", + "justify-end": position === "top-right", + }); return ( - <> - {show && ( -
+ + {}}> +
-
- {/* Header */} -
-

{title}

+ + + {/* Header */} + +

{title}

- -
+ + - {children} -
+ {/* Body */} +
+ {children} +
+ +
- )} - +
+
); }; - -Modal.Body = React.forwardRef(({ children, className, ...rest }, ref) => { - // Constants. - const customClassNames = classNames( - "p-4 overflow-y-auto text-gray-50", - className - ); - - return ( -
- {children} -
- ); -}); - -Modal.Footer = React.forwardRef(({ children, className, ...rest }, ref) => { - // Constants. - const customClassNames = classNames( - "flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-700", - className - ); - - return ( -
- {children} -
- ); -}); diff --git a/src/components/modal/type.ts b/src/components/modal/type.ts index 433811d..ba16bfe 100644 --- a/src/components/modal/type.ts +++ b/src/components/modal/type.ts @@ -5,10 +5,5 @@ export type ModalBaseProps = HTMLProps; export type ModalProps = ModalBaseProps & { title: string; - size?: "sm" | "md" | "lg"; -}; - -export type ModalComponents = { - Body: ForwardRef; - Footer: ForwardRef; + position?: "center" | "top-center" | "top-right"; }; diff --git a/src/map-container/helpers.ts b/src/map-container/helpers.ts index 934c961..b7908aa 100644 --- a/src/map-container/helpers.ts +++ b/src/map-container/helpers.ts @@ -33,7 +33,7 @@ export const setupMapControls = (map: Map) => { "bottom-right" ); - map.addControl(new FullscreenControl({}), "top-right"); + map.addControl(new FullscreenControl({}), "bottom-right"); map.addControl(new ScaleControl({}), "bottom-left"); };