Projekt

Obecné

Profil

« Předchozí | Další » 

Revize e9c60748

Přidáno uživatelem Dominik Poch před více než 2 roky(ů)

Added basic login form

Zobrazit rozdíly:

webapp/pages/authentication/login.tsx
1
import { Form, Input, Button } from 'antd';
2
import { UserOutlined, LockOutlined } from '@ant-design/icons';
3
import 'antd/dist/antd.css';
4

  
5
function Login() {
6
    const onFinish = (values: any) => {
7
        console.log('Values of the login form: ', values);
8
    };
9

  
10
    const onFinishFailed = (errorInfo: any) => {
11
        console.log('Errors: ', errorInfo);
12
    };
13

  
14
    return (
15
        <Form
16
            name="login"
17
            onFinish={onFinish}
18
            onFinishFailed={onFinishFailed}
19
            autoComplete="off"
20
        >
21
            <Form.Item
22
                name="email"
23
                rules={[{ required: true, message: 'Email musí být zadaný!' }]}
24
            >
25
                <Input
26
                    prefix={<UserOutlined className="site-form-item-icon" />}
27
                    placeholder="Email"
28
                />
29
            </Form.Item>
30

  
31
            <Form.Item
32
                name="password"
33
                rules={[{ required: true, message: 'Heslo musí být zadané!' }]}
34
            >
35
                <Input.Password
36
                    prefix={<LockOutlined className="site-form-item-icon" />}
37
                    placeholder="Heslo"
38
                />
39
            </Form.Item>
40
            <Form.Item>
41
                <Button type="primary" htmlType="submit">
42
                    Přihlásit
43
                </Button>
44
            </Form.Item>
45
        </Form>
46
    );
47
}
48

  
49
export default Login;

Také k dispozici: Unified diff