選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

add-user-modal.tsx 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { IModalProps } from '@/interfaces/common';
  2. import { Form, Input, Modal } from 'antd';
  3. import { useTranslation } from 'react-i18next';
  4. const AddingUserModal = ({
  5. visible,
  6. hideModal,
  7. loading,
  8. onOk,
  9. }: IModalProps<string>) => {
  10. const [form] = Form.useForm();
  11. const { t } = useTranslation();
  12. type FieldType = {
  13. email?: string;
  14. };
  15. const handleOk = async () => {
  16. const ret = await form.validateFields();
  17. return onOk?.(ret.email);
  18. };
  19. return (
  20. <Modal
  21. title={t('setting.add')}
  22. open={visible}
  23. onOk={handleOk}
  24. onCancel={hideModal}
  25. okButtonProps={{ loading }}
  26. confirmLoading={loading}
  27. >
  28. <Form
  29. name="basic"
  30. labelCol={{ span: 6 }}
  31. wrapperCol={{ span: 18 }}
  32. autoComplete="off"
  33. form={form}
  34. >
  35. <Form.Item<FieldType>
  36. label={t('setting.email')}
  37. name="email"
  38. rules={[{ required: true }]}
  39. >
  40. <Input />
  41. </Form.Item>
  42. </Form>
  43. </Modal>
  44. );
  45. };
  46. export default AddingUserModal;