feat(ui): improve confirm dialog styling

This commit is contained in:
Adam Shiervani 2025-08-11 16:23:10 +02:00
parent 9d0e62f80e
commit 5c07b8444c
1 changed files with 14 additions and 17 deletions

View File

@ -1,13 +1,10 @@
import { import { CheckCircleIcon } from "@heroicons/react/24/outline";
CheckCircleIcon, import { CloseButton } from "@headlessui/react";
ExclamationTriangleIcon, import { LuInfo, LuOctagonAlert, LuTriangleAlert } from "react-icons/lu";
InformationCircleIcon,
} from "@heroicons/react/24/outline";
import { Button } from "@/components/Button"; import { Button } from "@/components/Button";
import Modal from "@/components/Modal"; import Modal from "@/components/Modal";
import { cx } from "@/cva.config"; import { cx } from "@/cva.config";
type Variant = "danger" | "success" | "warning" | "info"; type Variant = "danger" | "success" | "warning" | "info";
interface ConfirmDialogProps { interface ConfirmDialogProps {
@ -24,27 +21,27 @@ interface ConfirmDialogProps {
const variantConfig = { const variantConfig = {
danger: { danger: {
icon: ExclamationTriangleIcon, icon: LuOctagonAlert,
iconClass: "text-red-600", iconClass: "text-red-600",
iconBgClass: "bg-red-100", iconBgClass: "bg-red-100 border border-red-500/90",
buttonTheme: "danger", buttonTheme: "danger",
}, },
success: { success: {
icon: CheckCircleIcon, icon: CheckCircleIcon,
iconClass: "text-green-600", iconClass: "text-green-600",
iconBgClass: "bg-green-100", iconBgClass: "bg-green-100 border border-green-500/90",
buttonTheme: "primary", buttonTheme: "primary",
}, },
warning: { warning: {
icon: ExclamationTriangleIcon, icon: LuTriangleAlert,
iconClass: "text-yellow-600", iconClass: "text-yellow-600",
iconBgClass: "bg-yellow-100", iconBgClass: "bg-yellow-100 border border-yellow-500/90",
buttonTheme: "lightDanger", buttonTheme: "primary",
}, },
info: { info: {
icon: InformationCircleIcon, icon: LuInfo,
iconClass: "text-blue-600", iconClass: "text-blue-600",
iconBgClass: "bg-blue-100", iconBgClass: "bg-blue-100 border border-blue-500/90",
buttonTheme: "primary", buttonTheme: "primary",
}, },
} as Record< } as Record<
@ -94,9 +91,9 @@ export function ConfirmDialog({
</div> </div>
</div> </div>
<div className="flex justify-end gap-x-2"> <div className="flex justify-end gap-x-2" autoFocus>
{cancelText && ( {cancelText && (
<Button size="SM" theme="blank" text={cancelText} onClick={onClose} /> <CloseButton as={Button} size="SM" theme="blank" text={cancelText} />
)} )}
<Button <Button
size="SM" size="SM"