LoginComp.js 3.95 KB
Newer Older
Spark's avatar
Spark committed
1
import React, { useState } from 'react';
Spark's avatar
Spark committed
2
import '../App.css'
Spark's avatar
Spark committed
3
import { Form, Button, Row, Col, Card, Alert } from 'react-bootstrap';
Spark's avatar
Spark committed
4
import { LoginWithKakao } from '../utils/Oauth';
Spark's avatar
Spark committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

function LoginComp() {

    const cardstyled = {
        margin: 'auto',
        padding: '1em',
        display: 'flex',
        justifyContent: 'center',
        width: '100%',
        borderWidth: '3px',
        borderRadius: '20px',
        borderColor: 'rgb(110, 189, 142)',
        color: '#04AB70'
    }

    const inboxstyled = {
        display: 'flex',
        flexDirection: 'column',
Spark's avatar
Spark committed
23
        maxWidth: '80%',
Spark's avatar
Spark committed
24
25
26
27
28
        justifyContent: 'center',
        margin: 'auto',
        padding: '10px'
    }

Spark's avatar
Spark committed
29
30
31
32
33
    const [emailSent, setEmailSent] = useState(false)
    const [alertShow, setAlertShow] = useState(true)

    function CheckEmailSend() {
        setEmailSent(!emailSent)
Spark's avatar
Spark committed
34
        localStorage.setItem('Email-Address', emailAddress)
Spark's avatar
Spark committed
35
    }
Spark's avatar
Spark committed
36

Spark's avatar
Spark committed
37
38
39
40
41
42
43
44
    const [emailAddress, setEmailAddress] = useState('')

    function handleChange(event) {
        setEmailAddress(event.target.value)
        console.log(emailAddress)
    }

    const 
Spark's avatar
Spark committed
45
46
47
    return (
        <Row className='text-center w-100 my-2'>
            <Card style={cardstyled}>
Spark's avatar
Spark committed
48
                <Card.Title id='impactTitle'>
Spark's avatar
Spark committed
49
50
                    LOGIN
                </Card.Title>
Spark's avatar
Spark committed
51
52
53
                <Card.Subtitle style={{ fontWeight: 'lighter' }}>
                    Log in with your social media account or email address
                </Card.Subtitle>
Spark's avatar
Spark committed
54
55
                <hr />
                <Card.Text>
Spark's avatar
Spark committed
56
57
58
59
60
61
                    <Row className='m-auto d-flex justify-content-center' style={{ width: '80%' }}>
                        {!emailSent ?
                            <Alert show={alertShow} variant={'success'}>
                                <Col>
                                    😍 이메일 전송이 완료 되었습니다.
                                </Col>
Spark's avatar
Spark committed
62
                                <Alert.Link href='/' target='_blank' style={{ fontSize: '0.8em' }}>
Spark's avatar
Spark committed
63
64
65
66
67
68
69
70
71
72
73
74
75
                                    이메일 확인 하러가기 
                                </Alert.Link>
                            </Alert>
                            :
                            <Alert show={alertShow} variant={'danger'}>
                                <Col>
                                    😭 이메일을 정확하게 적어주세요.
                                </Col>
                            </Alert>
                        }
                        <Button onClick={() => setAlertShow(true)}>보여주고</Button>
                        <Button onClick={() => setAlertShow(false)}>안보여주고</Button>
                    </Row>
Spark's avatar
Spark committed
76
77
                    <Form style={inboxstyled}>
                        <Form.Group controlId="formBasicEmail">
Spark's avatar
Spark committed
78
                            <Form.Control type="email" placeholder="Email" onChange={handleChange} />
Spark's avatar
Spark committed
79
                        </Form.Group>
Spark's avatar
Spark committed
80
                        <Button variant='light' type="submit" id='formbtn' onClick={CheckEmailSend}>
Spark's avatar
Spark committed
81
82
                            LOGIN
                        </Button>
Spark's avatar
Spark committed
83

Spark's avatar
Spark committed
84
                    </Form>
Spark's avatar
Spark committed
85
86
87
88
89
90
91
92
93
94
95

                    <Row className='d-flex align-items-center m-2'>
                        <Col>
                            <hr />
                        </Col>
                        OR
                        <Col>
                            <hr />
                        </Col>
                    </Row>

Spark's avatar
Spark committed
96
97
98
                    <Row style={{ margin: 'auto', marginBottom: '5px', display: 'flex', justifyContent: 'center' }}>
                        <a href="#;" onClick={LoginWithKakao} id='socialLink' >
                            {/* 세미콜론이 붙으면 최상단 이동 x */}
Spark's avatar
Spark committed
99
                            <img src='http://image.kmib.co.kr/online_image/2020/0626/611514110014734788_1.jpg' id='logpng' alt='KAKAO' />
Spark's avatar
Spark committed
100
101
102
103
104
105
106
107
108
109
110
                        </a>

                    </Row>
                </Card.Text>
            </Card>

        </Row>
    )
}

export default LoginComp;