2023-03-22 17:51:51 -04:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
DialogClose,
|
|
|
|
|
DialogContent,
|
|
|
|
|
DialogDescription,
|
|
|
|
|
DialogFooter,
|
|
|
|
|
DialogHeader,
|
|
|
|
|
DialogTitle
|
|
|
|
|
} from './Dialog.tsx';
|
2023-04-02 04:15:07 +08:00
|
|
|
import { cn } from '~/utils/';
|
2023-03-22 17:51:51 -04:00
|
|
|
|
2023-04-03 12:54:15 +08:00
|
|
|
export default function DialogTemplate({
|
|
|
|
|
title,
|
|
|
|
|
description,
|
|
|
|
|
main,
|
|
|
|
|
buttons,
|
|
|
|
|
leftButtons,
|
|
|
|
|
selection,
|
|
|
|
|
className
|
|
|
|
|
}) {
|
|
|
|
|
const { selectHandler, selectClasses, selectText } = selection || {};
|
2023-03-22 17:51:51 -04:00
|
|
|
|
2023-04-02 04:15:07 +08:00
|
|
|
const defaultSelect =
|
|
|
|
|
'bg-gray-900 text-white transition-colors hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200 dark:focus:ring-gray-400 dark:focus:ring-offset-gray-900';
|
2023-03-22 17:51:51 -04:00
|
|
|
return (
|
2023-04-02 04:15:07 +08:00
|
|
|
<DialogContent className={cn('shadow-2xl dark:bg-gray-800', className || '')}>
|
2023-03-22 17:51:51 -04:00
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle className="text-gray-800 dark:text-white">{title}</DialogTitle>
|
2023-05-18 11:09:31 -07:00
|
|
|
<DialogDescription className="text-gray-600 dark:text-gray-300">
|
|
|
|
|
{description}
|
|
|
|
|
</DialogDescription>
|
2023-03-22 17:51:51 -04:00
|
|
|
</DialogHeader>
|
|
|
|
|
{main ? main : null}
|
|
|
|
|
<DialogFooter>
|
2023-04-03 12:54:15 +08:00
|
|
|
<div>{leftButtons ? leftButtons : null}</div>
|
2023-04-04 01:12:14 +08:00
|
|
|
<div className="flex gap-2">
|
2023-04-03 12:54:15 +08:00
|
|
|
<DialogClose className="dark:hover:gray-400 border-gray-700">Cancel</DialogClose>
|
|
|
|
|
{buttons ? buttons : null}
|
|
|
|
|
{selection ? (
|
|
|
|
|
<DialogClose
|
|
|
|
|
onClick={selectHandler}
|
|
|
|
|
className={`${
|
|
|
|
|
selectClasses || defaultSelect
|
2023-05-18 11:09:31 -07:00
|
|
|
} inline-flex h-10 items-center justify-center rounded-md border-none px-4 py-2 text-sm font-semibold`}
|
2023-04-03 12:54:15 +08:00
|
|
|
>
|
|
|
|
|
{selectText}
|
|
|
|
|
</DialogClose>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
2023-03-22 17:51:51 -04:00
|
|
|
</DialogFooter>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
);
|
|
|
|
|
}
|