import React from 'react';
import { Form, Input, Space } from 'antd';

export const UserForm = ({ nameProps, emailProps }) => (
  <Space.Compact block>
    <Form.Item
      {...nameProps}
      style={{ margin: 0, width: '50%' }}
      rules={[{ required: true, message: '请输入姓名!' }]}
    >
      <Input placeholder="姓名" />
    </Form.Item>
    <Form.Item
      {...emailProps}
      style={{ margin: 0, width: '50%' }}
      rules={[
        { required: true, message: '请输入邮箱!' },
        { type: 'email', message: '请输入有效的邮箱!' }
      ]}
    >
      <Input placeholder="邮箱" />
    </Form.Item>
  </Space.Compact>
);