Login.js 3.26 KB
Newer Older
Kim, Subin's avatar
Kim, Subin committed
1
import React, { useState, useEffect, useRef } from 'react';
2
import { Link, Redirect } from 'react-router-dom';
Kim, Subin's avatar
Kim, Subin committed
3
4
import Nav1 from '../Components/MainNav';
import Nav2 from '../Components/SubNav';
5
import { Form, Col, Container, Button, Row } from 'react-bootstrap';
이재연's avatar
logsign    
이재연 committed
6

박상호's avatar
0104    
박상호 committed
7
function Login() {
이재연's avatar
이재연 committed
8

박상호's avatar
0104    
박상호 committed
9
    const [validated, setValidated] = useState(false);
이재연's avatar
이재연 committed
10

박상호's avatar
0104    
박상호 committed
11
12
    const handleSubmit = (e) => {
        const form = e.currentTarget;
이재연's avatar
이재연 committed
13
        console.log(form)
박상호's avatar
1-6    
박상호 committed
14
        if (form.checkValidity() === false) { //checkValidity 는 입력 요소에 유효한 데이터가 포함되어 있는지 확인
이재연's avatar
이재연 committed
15
16
17
18
19
            e.preventDefault();
            e.stopPropagation();
        }
        setValidated(true);
    }
Kim, Subin's avatar
Kim, Subin committed
20
    return (
이재연's avatar
logsign    
이재연 committed
21
        <div>
Kim, Subin's avatar
Kim, Subin committed
22
23
            <Nav1 />
            <Nav2 />
이재연's avatar
logsign    
이재연 committed
24
25
            <Container className="my-5">
                <Row className="justify-content-center">
이재연's avatar
이재연 committed
26
                    <Col md={5} xs={10} className="border" style={{ background: '#F7F3F3' }}>
이재연's avatar
logsign    
이재연 committed
27
                        <h3 className="text-center mt-5">Login</h3>
박상호's avatar
0104    
박상호 committed
28
                        <Form noValidate validated={validated} onSubmit={handleSubmit} className="p-5">
이재연's avatar
logsign    
이재연 committed
29
30
                            <Form.Group controlId="formBasicId">
                                <Form.Row>
이재연's avatar
이재연 committed
31
                                    <Col sm={4} xs={6} as={Form.Label} for="id"> 아이디</Col>
박상호's avatar
0104    
박상호 committed
32
33
34
35
36
37
38
39
                                    <Col sm={8} xs={12} as={Form.Control}
                                        required
                                        type="text"
                                        id="id"
                                        placeholder="ID"
                                        style={{ width: '160px' }}>
                                    </Col>
                                    <Form.Control.Feedback className="text-center" type="invalid"> 아이디를 입력하세요.</Form.Control.Feedback>
이재연's avatar
logsign    
이재연 committed
40
41
42
43
44
                                </Form.Row>
                            </Form.Group>

                            <Form.Group controlId="formBasicPassword">
                                <Form.Row>
이재연's avatar
이재연 committed
45
                                    <Col sm={4} xs={6} as={Form.Label} for="password">비밀번호</Col>
박상호's avatar
0104    
박상호 committed
46
47
48
49
50
51
                                    <Col sm={8} xs={12} as={Form.Control}
                                        type="password"
                                        id="password"
                                        placeholder="Password"
                                        style={{ width: '160px' }}
                                        required />
이재연's avatar
이재연 committed
52
53
54
                                    <Form.Control.Feedback className="text-center" type="invalid">
                                        비밀번호를 입력하세요.
                                    </Form.Control.Feedback>
이재연's avatar
logsign    
이재연 committed
55
56
                                </Form.Row>
                            </Form.Group>
이재연's avatar
이재연 committed
57
                            <Button style={{ background: '#91877F', borderColor: '#91877F' }} type="submit" block>Login</Button>
이재연's avatar
logsign    
이재연 committed
58
                            <div className="loginLine">
이재연's avatar
이재연 committed
59
                                <Link to="/signup" style={{ color: '#91877F' }}>회원이 아니십니까?</Link>
이재연's avatar
logsign    
이재연 committed
60
61
62
63
64
65
                            </div>
                        </Form>
                    </Col>
                </Row>
            </Container>
        </div>
Kim, Subin's avatar
Kim, Subin committed
66
67
68
69
    )
}

export default Login