import React, { useEffect, useState} from 'react';

import { Form, Input, Button, Checkbox } from 'antd';

import './index.less';

const layout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};
const tailLayout = {
    wrapperCol: { offset: 8, span: 16 },
};

export default ()=> {
    const onFinish = (values) => {
        console.log('Success:', values);
    };

    const onFinishFailed = (errorInfo) => {
        console.log('Failed:', errorInfo);
    };
    
    return (
        <div className="login">
            <h1>Login</h1>
            <div className="login__form">
                <Form
                    {...layout}
                    name="basic"
                    initialValues={{
                        remember: true,
                    }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    >
                    <Form.Item
                        label="Usuário"
                        name="username"
                        rules={[
                        {
                            required: true,
                            message: 'Por favor preencha o seu usuário.',
                        },
                        ]}
                    >
                        <Input />
                    </Form.Item>

                    <Form.Item
                        label="Senha"
                        name="password"
                        rules={[
                        {
                            required: true,
                            message: 'Por favor preencha o seu senha.',
                        },
                        ]}
                    >
                        <Input.Password />
                    </Form.Item>

                    <Form.Item {...tailLayout} name="remember" valuePropName="checked">
                        <Checkbox>Relembrar o acesso.</Checkbox>
                    </Form.Item>

                    <Form.Item {...tailLayout}>
                        <Button type="primary" htmlType="submit">
                        Entrar
                        </Button>
                    </Form.Item>
                </Form>
            </div>
        </div>
    );
};
