import React from 'react';
import { Modal, Form } from 'antd';
import { UserForm } from './UserForm';
import { RoleSelect } from './RoleSelect';

export const AddMemberModal = ({ 
  visible, 
  onOk, 
  onCancel, 
  form 
}) => (
  <Modal
    title="添加成员"
    open={visible}
    onOk={onOk}
    onCancel={onCancel}
  >
    <Form form={form} layout="vertical">
      <Form.Item label="成员信息">
        <UserForm
          nameProps={{ name: ['user', 'name'] }}
          emailProps={{ name: ['user', 'email'] }}
        />
      </Form.Item>
      <Form.Item
        name="role"
        label="角色"
        rules={[{ required: true, message: '请选择角色!' }]}
      >
        <RoleSelect />
      </Form.Item>
    </Form>
  </Modal>
);