LocalCode.js 2.64 KB
Newer Older
Spark's avatar
Spark committed
1
import React, { useState } from 'react'
2
import { Container, Row, Card, Table, Button, Col, Modal } from 'react-bootstrap';
Spark's avatar
Spark committed
3
// import db from "../db/index"
4
import '../App.css'
Spark's avatar
Spark committed
5
import { LoginWithKakao } from '../utils/Oauth';
6
7
8


function LocalCode() {
Spark's avatar
Spark committed
9
10
11

    const kakao_accToken = localStorage.getItem('Kakao_token')

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    const cardstyled = {
        margin: 'auto',
        padding: '1em',
        display: 'flex',
        justifyContent: 'center',
        width: '100%',
        borderWidth: '3px',
        borderRadius: '20px',
        borderColor: 'rgba(195, 195, 195, 0.753)',
        color: 'rgb(110, 189, 142)'
    }
    const btnstyled2 = {
        background: 'white',
        margin: 'auto',
        borderWidth: '2px',
        fontSize: '0.5em',
        color: 'rgb(110, 189, 142)',
        borderColor: 'rgba(195, 195, 195, 0.753)',
        borderRadius: '20px',
    }

Spark's avatar
Spark committed
33
    const [localChange, setLocalChange] = useState(false)
Spark's avatar
Spark committed
34
    const user_email = localStorage.getItem('user_email')
35
36
37
38
39
    return (
        <>
            <Col className='text-center pt-3 pb-2 px-0'>
                <Card style={cardstyled} id='localName'>
                    <Card.Title>
Spark's avatar
Spark committed
40
41
42
43
44
45
46
                        {kakao_accToken ?
                            `${user_email}`
                            :
                            <>
                                GUEST
                            </>
                        }
47
48
49
50
51
                    </Card.Title>
                    <Row style={{ alignItems: 'center', margin: 'auto', whiteSpace: 'nowrap' }}>
                        <Card.Subtitle>
                            지역코드
                        </Card.Subtitle>
Spark's avatar
Spark committed
52
53
54
55
56
                        {kakao_accToken &&
                            <Button variant='light' className='ml-1' onClick={() => setLocalChange(true)} style={btnstyled2}>
                                변경
                            </Button>
                        }
57
                    </Row>
Spark's avatar
Spark committed
58
59
60
61
62
63
64
65
66
67
68
69
                    <Modal
                        show={localChange}
                        onHide={() => setLocalChange(false)}
                    >
                        <Modal.Header className='d-block text-center'>
                            <Modal.Title>
                                마이페이지
                            </Modal.Title>
                        </Modal.Header>
                        <Modal.Body>
                            지역이름 (지역코드)
                        </Modal.Body>
70
71
72
73
74
75
76
77
78
79
                    </Modal>

                    환경을 향한 노력 <br />
                    <strong>OOO  </strong>
                </Card>
            </Col>
        </>
    )
}
export default LocalCode;