refactor(social): use Modal for AddAccountDialog

This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:04:24 -04:00
1 parent 8541836b26
commit 69724f0188
1 file changed
+5 -33
@@ -1,8 +1,7 @@
import { useState } from "react"; import { useState } from "react";
import { motion } from "framer-motion"; import { SignIn } from "@phosphor-icons/react";
import { SignIn, X } from "@phosphor-icons/react";
import type { SocialPlatform } from "@shared/types"; import type { SocialPlatform } from "@shared/types";
import { ActionButton } from "../ui"; import { ActionButton, Modal } from "../ui";
import { platformConfig } from "./social-config"; import { platformConfig } from "./social-config";
interface AddAccountDialogProps { interface AddAccountDialogProps {
@@ -15,27 +14,7 @@ export function AddAccountDialog({ onAddAndLogin, onClose }: AddAccountDialogPro
const [requireApproval, setRequireApproval] = useState(true); const [requireApproval, setRequireApproval] = useState(true);
return ( return (
<motion.div <Modal open onClose={onClose} title="Add Social Account" width="420px">
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4"
onClick={onClose}
>
<motion.div
initial={{ scale: 0.95, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.95, opacity: 0 }}
className="w-full max-w-[420px] rounded-lg border border-border bg-card p-6 shadow-xl"
onClick={(e) => e.stopPropagation()}
>
<div className="mb-5 flex items-center justify-between">
<h3 className="text-[16px] font-bold text-foreground">Add Social Account</h3>
<button type="button" onClick={onClose} className="rounded-lg p-1 text-muted-foreground hover:bg-muted">
<X size={18} />
</button>
</div>
<div className="space-y-4"> <div className="space-y-4">
<div> <div>
<label className="mb-1.5 block text-[12px] font-medium text-muted-foreground">Platform</label> <label className="mb-1.5 block text-[12px] font-medium text-muted-foreground">Platform</label>
@@ -85,13 +64,7 @@ export function AddAccountDialog({ onAddAndLogin, onClose }: AddAccountDialogPro
</div> </div>
<div className="mt-6 flex justify-end gap-3"> <div className="mt-6 flex justify-end gap-3">
<button <ActionButton label="Cancel" onClick={onClose} />
type="button"
onClick={onClose}
className="rounded-lg px-4 py-2 text-[12px] font-medium text-muted-foreground transition hover:bg-muted"
>
Cancel
</button>
<ActionButton <ActionButton
label="Login" label="Login"
onClick={() => onAddAndLogin(platform, requireApproval)} onClick={() => onAddAndLogin(platform, requireApproval)}
@@ -99,7 +72,6 @@ export function AddAccountDialog({ onAddAndLogin, onClose }: AddAccountDialogPro
tone="accent" tone="accent"
/> />
</div> </div>
</motion.div> </Modal>
</motion.div>
); );
} }