Login.js 3.22 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
이재연 committed
7
8
9
10
11
12
13
14
15
16
17
18
19
function Login(){

    const [validated,setValidated]=useState(false);

    const handleSubmit=(e)=>{
        const form =e.currentTarget;
        console.log(form)
        if(form.checkValidity() === false){
            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
이재연 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
32
33
                                    <Col sm={4} xs={6} as={Form.Label} for="id"> 아이디</Col>
                                        <Col sm={8} xs={12} as={Form.Control}
                                            required
이재연's avatar
이재연 committed
34
35
                                            type="text"
                                            id="id"
이재연's avatar
이재연 committed
36
37
38
39
                                            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
46
                                    <Col sm={4} xs={6} as={Form.Label} for="password">비밀번호</Col>
                                        <Col sm={8} xs={12} as={Form.Control}
이재연's avatar
이재연 committed
47
48
                                            type="password"
                                            id="password"
이재연's avatar
이재연 committed
49
50
51
52
53
54
                                            placeholder="Password"
                                            style={{ width: '160px' }}
                                            required />
                                    <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