"use client"
import React, { ReactNode } from "react"
import * as Dialog from "@radix-ui/react-dialog"
import { cva } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Icons } from "../icons"
interface ModalProps {
open: boolean
setOpen: (open: boolean) => void
title?: string
children?: ReactNode
footer?: ReactNode
size?: "lg" | "md" | "xl"
className?: string
}
interface ModalWrapperProps {
children?: ReactNode
className?: string
}
const ModalContent = ({ children, className = "" }: ModalWrapperProps) => {
return
{children}
}
const modalContentVariants = cva(
"data-[state=open]:animate-content-show flex flex-col bg-white dark:bg-black rounded-b-none rounded-t-lg md:rounded-lg shadow-sm top-3 bottom-0 fixed md:-translate-y-1/2 md:-translate-x-1/2 md:top-1/2 md:left-1/2 md:h-full md:max-h-[80vh] focus:outline-none z-50 dark:border dark:border-anakiwa-800",
{
variants: {
size: {
md: "w-full max-w-2xl",
lg: "w-full max-w-3xl",
xl: "w-full max-w-4xl",
},
},
defaultVariants: {
size: "lg",
},
}
)
const Modal = ({
title,
children,
footer,
size,
open,
setOpen,
className = "",
}: ModalProps) => (
{title && (
{title}
)}
{children}
{footer && (
{footer}
)}
)
Modal.displayName = "Modal"
export { Modal, modalContentVariants }