import React from 'react';
import { Form, Icon, Input, Button, Checkbox } from 'antd';
const FormItem = Form.Item;

const LoginForm = Form.create()(React.createClass({
    handleSubmit(e) {
        e.preventDefault();
        this.props.form.validateFields((err, values) => {
            if (!err) {
                console.log('Received values of form: ', values);
            }
        });
    },
    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <Form onSubmit={this.handleSubmit} className="login-form">
                <FormItem>
                    {getFieldDecorator('userName', {
                        rules: [{ required: true, message: 'Please input your username!' }],
                    })(
                        <div>
                            <span>用 &nbsp;&nbsp; 户 :</span><Input placeholder="Username" />
                        </div>
                        )}
                </FormItem>
                <FormItem>
                    {getFieldDecorator('password', {
                        rules: [{ required: true, message: 'Please input your Password!' }],
                    })(
                        <div>
                            <span>密 &nbsp;&nbsp; 码 :</span><Input type="password" placeholder="Password" />
                        </div>
                        )}
                </FormItem>
                <FormItem>
                    {getFieldDecorator('remember', {
                        valuePropName: 'checked',
                        initialValue: true,
                    })(
                        <Checkbox>记住我</Checkbox>
                        )}
                    <Button type="primary" htmlType="submit" className="login-form-button">
                        登录
                    </Button>
                    <p className="reg"><a className="login-form-forgot">忘记密码</a><a>加入我们</a></p>
                </FormItem>
            </Form>
        );
    },
}));

export default LoginForm;