Migrate all modals to ts

This commit is contained in:
2025-05-12 21:26:07 +02:00
parent b7be5a46a2
commit 924d710b2f
11 changed files with 160 additions and 48 deletions

View File

@@ -0,0 +1,63 @@
import React, { useState } from 'react';
import {
Modal,
Text,
Button,
Group,
Stack,
PasswordInput,
} from '@mantine/core';
interface EmailPasswordModalProps {
opened: boolean;
onClose: () => void;
onConfirm: (password: string) => Promise<void>;
email: string;
}
const EmailPasswordModal: React.FC<EmailPasswordModalProps> = ({
opened,
onClose,
onConfirm,
email,
}) => {
const [password, setPassword] = useState<string>('');
return (
<Modal
opened={opened}
onClose={onClose}
title="Confirm Password"
centered
size="sm"
>
<Stack>
<Text size="sm">
Please enter your password to confirm changing your email to: {email}
</Text>
<PasswordInput
label="Current Password"
placeholder="Enter your current password"
value={password}
onChange={(e) => setPassword(e.currentTarget.value)}
required
/>
<Group justify="flex-end" mt="md">
<Button variant="default" onClick={onClose}>
Cancel
</Button>
<Button
onClick={() => {
onConfirm(password);
setPassword('');
}}
>
Confirm
</Button>
</Group>
</Stack>
</Modal>
);
};
export default EmailPasswordModal;