import { forwardRef, ReactNode, Ref } from 'react'; import { OGDialogTitle, OGDialogClose, OGDialogFooter, OGDialogHeader, OGDialogContent, OGDialogDescription, } from './OriginalDialog'; import { useLocalize } from '~/hooks'; import { cn } from '~/utils/'; type SelectionProps = { selectHandler?: () => void; selectClasses?: string; selectText?: string | ReactNode; }; type DialogTemplateProps = { title: string; description?: string; main?: ReactNode; buttons?: ReactNode; leftButtons?: ReactNode; selection?: SelectionProps; className?: string; overlayClassName?: string; headerClassName?: string; mainClassName?: string; footerClassName?: string; showCloseButton?: boolean; showCancelButton?: boolean; }; const OGDialogTemplate = forwardRef((props: DialogTemplateProps, ref: Ref) => { const localize = useLocalize(); const { title, main, buttons, selection, className, leftButtons, description = '', mainClassName, headerClassName, footerClassName, showCloseButton, overlayClassName, showCancelButton = true, } = props; const { selectHandler, selectClasses, selectText } = selection || {}; const Cancel = localize('com_ui_cancel'); const defaultSelect = 'bg-gray-800 text-white transition-colors hover:bg-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-gray-200'; return ( e.stopPropagation()} > {title} {description && ( {description} )}
{main != null ? main : null}
{leftButtons != null ?
{leftButtons}
: null}
{buttons != null ? buttons : null} {showCancelButton && ( {Cancel} )} {selection ? ( {selectText} ) : null}
); }); export default OGDialogTemplate;