import { motion } from "framer-motion";

interface OverlayProps {
  func: (value: boolean) => void;
}

const overlayVariants = {
  hidden: { opacity: 0 },
  visible: {
    opacity: 1,
    transition: { duration: 0.3 },
  },
  exit: {
    opacity: 0,
    transition: { duration: 0.3 },
  },
};

export default function Overlay({ func }: OverlayProps) {
  return (
    <motion.div
      className="fixed inset-0 bg-black/20 z-20"
      initial="hidden"
      animate="visible"
      exit="exit"
      variants={overlayVariants}
      onClick={() => func(false)}
    />
  );
}
