MainLayer.js 3.42 KB
Newer Older
Spark's avatar
layout    
Spark committed
1
2
3
import React from 'react'
import { useState } from 'react';
import { Button, Form, Image, Row, ButtonGroup, Modal, Dropdown, Col } from 'react-bootstrap';
Spark's avatar
Spark committed
4
import { Link, useHistory } from 'react-router-dom';
Spark's avatar
layout    
Spark committed
5
import '../App.css'
Spark's avatar
Spark committed
6
import LoginComp from './LoginComp';
Spark's avatar
Spark committed
7
import { isLogined, isOauth } from '../utils/Auth';
8
import LocalCode from '../components/LocalCode';
Spark's avatar
Spark committed
9
10
// import { isOauthChecked } from './../utils/Auth';
import Oauth, { checkAuth, kakaoLogout, unlinkApp } from './../utils/Oauth';
11

Spark's avatar
layout    
Spark committed
12
13

function MainLayer() {
Spark's avatar
Spark committed
14
    const history = useHistory()
Spark's avatar
layout    
Spark committed
15
16
17
18
19

    const boxstyled = {
        border: 'solid',
        color: 'rgba(195, 195, 195, 0.753)',
        borderRadius: '20px',
20
        borderWidth: '3px',
Spark's avatar
layout    
Spark committed
21
22
23
        marginBottom: '1em',
        width: '100%',
        backgroundSize: 'contain',
24
25
        margin: 'auto',
        textDecorationColor: 'none'
Spark's avatar
layout    
Spark committed
26
27
28
29
30
31
32
33
34
35
36
    }

    const btnstyled = {
        background: 'rgb(110, 189, 142)',
        margin: '1px',
        display: 'flex',
        justifyContent: 'center',
        maxWidth: '100%',
        borderWidth: '2px',
        borderColor: 'rgba(195, 195, 195, 0.753)',
        borderRadius: '20px',
37
38
        textDecorationColor: 'none',
        color: 'white'
Spark's avatar
layout    
Spark committed
39
40
41
    }

    const [logshow, setLogshow] = useState(false);
Spark's avatar
Spark committed
42
    const kakao_accToken = localStorage.getItem('Kakao_token')
Spark's avatar
layout    
Spark committed
43
44
45
46

    return (
        <>
            <Row className='d-flex align-items-center m-auto w-100'>
47
48
49
                <Link to='/' className=' m-auto'>
                    <Image src='/images/EUE11.jpg' alt='EUE' style={boxstyled} />
                </Link>
Spark's avatar
layout    
Spark committed
50
51
            </Row>

52
53
54
55
56
            <Row className='m-auto d-flex justify-content-center w-100'>
                <LocalCode />
            </Row>
            <Row className='d-flex justify-content-center align-items-center my-2 mx-auto w-100'>
                <ButtonGroup vertical className='m-auto' style={{ width: '100%', flexDirection: 'column' }}>
Spark's avatar
Spark committed
57
58
59
                    {kakao_accToken ?
                        //true
                        <Button variant='light' style={btnstyled} onClick={kakaoLogout}>
60
61
62
                            로그아웃
                        </Button>
                        :
Spark's avatar
Spark committed
63
                        //false
Spark's avatar
Spark committed
64
65
66
67
                        <Button variant='light' style={btnstyled}>
                            <Link to='/login' id='btnlink'>
                                로그인
                            </Link>
68
69
                        </Button>
                    }
Spark's avatar
layout    
Spark committed
70
71
72
73
74
75
                    <Modal
                        size="sm"
                        show={logshow}
                        onHide={() => setLogshow(false)}
                        aria-labelledby="example-modal-sizes-title-sm"
                    >
Spark's avatar
Spark committed
76
                        <LoginComp />
Spark's avatar
layout    
Spark committed
77
                    </Modal>
Spark's avatar
Spark committed
78
79
80
81
82
83
84
85
86
87
                    {!kakao_accToken ?
                        <Button variant='light' style={btnstyled}>

                            <Link to='/signup' id='btnlink'>
                                회원가입
                            </Link>
                        </Button>
                        :
                        <Button variant='light' style={btnstyled} onClick={unlinkApp}>

Spark's avatar
Spark committed
88
                            연결끊기
Spark's avatar
Spark committed
89
90
91
                        </Button>

                    }
Spark's avatar
Spark committed
92

Spark's avatar
layout    
Spark committed
93
94
                </ButtonGroup>
            </Row>
95
96
97
            <Row className='m-auto justify-content-center w-100' id='contour'>
                |
            </Row>
Spark's avatar
layout    
Spark committed
98
99
100
101
102
        </>
    );
}

export default MainLayer