Skip to content

Commit

Permalink
chore: added type DELETE to confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline committed Oct 26, 2023
1 parent d5525d6 commit cf2b031
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion components/organisms/UserSettingsPage/user-settings-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ interface DeleteAccountModalProps {
}

const DeleteAccountModal = ({ open, setOpen, onDelete }: DeleteAccountModalProps) => {
const [confirmText, setConfirmText] = useState("");
const disabled = confirmText !== "DELETE";

return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent className="p-4">
Expand All @@ -49,14 +52,27 @@ const DeleteAccountModal = ({ open, setOpen, onDelete }: DeleteAccountModalProps
</DialogHeader>
<div className="flex flex-col gap-4">
<Text>Are you sure you want to delete your account?</Text>
<Text>
Type <span className="font-bold text-light-red-10">DELETE</span> in all caps to confirm
</Text>
<TextInput
onChange={(e) => {
setConfirmText(e.target.value);
}}
/>
<div className="flex gap-4">
<Button
type="submit"
rel="noopener noreferrer"
target="_blank"
className="w-max border-dark-red-8 bg-dark-red-8 text-white hover:border-dark-red-7 hover:bg-dark-red-7"
variant="primary"
onClick={onDelete}
onClick={() => {
if (!disabled) {
onDelete();
}
}}
disabled={disabled}
>
Delete
</Button>
Expand Down

0 comments on commit cf2b031

Please sign in to comment.