import { ComponentProps, Ref, ReactNode } from "react"; import classNames from "classnames"; import { ThemeColor, I18nText, useC } from "../common"; import { ButtonRow, ButtonRowV2 } from "../button"; import "./DialogContainer.css"; interface DialogContainerBaseProps { className?: string; title: I18nText; titleColor?: ThemeColor; titleClassName?: string; titleRef?: Ref; bodyContainerClassName?: string; bodyContainerRef?: Ref; buttonsClassName?: string; buttonsContainerRef?: ComponentProps["containerRef"]; children: ReactNode; } interface DialogContainerWithButtonsProps extends DialogContainerBaseProps { buttons: ComponentProps["buttons"]; } interface DialogContainerWithButtonsV2Props extends DialogContainerBaseProps { buttonsV2: ComponentProps["buttons"]; } type DialogContainerProps = | DialogContainerWithButtonsProps | DialogContainerWithButtonsV2Props; export default function DialogContainer(props: DialogContainerProps) { const { className, title, titleColor, titleClassName, titleRef, bodyContainerClassName, bodyContainerRef, buttonsClassName, buttonsContainerRef, children, } = props; const c = useC(); return (
{c(title)}

{children}

{"buttons" in props ? ( ) : ( )}
); }