Files
no-whatever/src/components/LeaveConfirmModal.tsx
T
kurihada 948274bcb9 refactor: 提取 Modal 基础组件,消除 4 个弹窗的重复样板代码
将 backdrop 遮罩、点击关闭、AnimatePresence 动画封装为 Modal 组件,
支持 sheet(底部弹出)和 dialog(居中缩放)两种变体,净减约 110 行。
2026-02-26 17:45:52 +08:00

49 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { LogOut } from "lucide-react";
import Modal from "@/components/Modal";
interface LeaveConfirmModalProps {
open: boolean;
onConfirm: () => void;
onCancel: () => void;
}
export default function LeaveConfirmModal({
open,
onConfirm,
onCancel,
}: LeaveConfirmModalProps) {
return (
<Modal open={open} onClose={onCancel} variant="dialog">
<div className="flex flex-col items-center">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-rose-500/15">
<LogOut size={22} className="text-rose-400" />
</div>
<h2 className="mt-4 text-base font-bold text-heading">
退
</h2>
<p className="mt-1.5 text-center text-xs leading-relaxed text-muted">
退
</p>
<div className="mt-5 flex w-full gap-2.5">
<button
onClick={onCancel}
className="flex h-11 flex-1 items-center justify-center rounded-xl bg-elevated text-sm font-semibold text-secondary ring-1 ring-border transition-colors active:bg-subtle"
>
</button>
<button
onClick={onConfirm}
className="flex h-11 flex-1 items-center justify-center rounded-xl bg-rose-500 text-sm font-semibold text-white shadow-lg shadow-rose-500/20 transition-colors active:bg-rose-600"
>
退
</button>
</div>
</div>
</Modal>
);
}