import { motion, AnimatePresence } from "framer-motion"; import React from "react"; import { TextButton } from "./Buttons/TextButton"; import { useEffect } from "react"; export const useDisableBodyScroll = (open: boolean) => { useEffect(() => { if (open) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = "unset"; } }, [open]); }; type OptionalChidrenProps> = T & { children?: React.ReactNode; }; type HeadElementAttr = React.HTMLAttributes; type DivElementAttr = React.HTMLAttributes; type ButtonElementAttr = React.HTMLAttributes; type DialogHeadlineProps = OptionalChidrenProps; type DialogSupportingTextProps = OptionalChidrenProps; type DialogButtonGroupProps = OptionalChidrenProps; interface DialogButtonProps extends OptionalChidrenProps { onClick?: React.MouseEventHandler; } interface DialogProps extends OptionalChidrenProps { show: boolean; children?: React.ReactNode; } export const DialogHeadline: React.FC = ({ children, className, ...rest }: DialogHeadlineProps) => { return (

{children}

); }; export const DialogSupportingText: React.FC = ({ children, className, ...rest }: DialogHeadlineProps) => { return (
{children}
); }; export const DialogButton: React.FC = ({ children, onClick, ...rest }: DialogButtonProps) => { return ( {children} ); }; export const DialogButtonGroup: React.FC = ({ children, ...rest }: DialogButtonGroupProps) => { return (
{children}
); }; export const Dialog: React.FC = ({ show, children, className }: DialogProps) => { useDisableBodyScroll(show); return ( {show && (
)}
); };