LocalCode.js 2.73 KB
Newer Older
Spark's avatar
Spark committed
1
import React, { useState } from 'react'
Spark's avatar
Spark committed
2
import { Row, Card, 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 { Link } from 'react-router-dom';
6
7
8


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

Spark's avatar
Spark committed
10
    const logined = localStorage.getItem('nickname')
Spark's avatar
Spark committed
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    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
32
    const [localChange, setLocalChange] = useState(false)
Spark's avatar
Spark committed
33
    const nickname = localStorage.getItem('nickname')
34
35
36
37
38
    return (
        <>
            <Col className='text-center pt-3 pb-2 px-0'>
                <Card style={cardstyled} id='localName'>
                    <Card.Title>
Spark's avatar
Spark committed
39
40
                        {logined ?
                            `${nickname}`
Spark's avatar
Spark committed
41
42
43
44
                            :
                            <>
                                GUEST
                            </>
Spark's avatar
Spark committed
45
                        }, 환영합니다.
46
47
48
49
50
                    </Card.Title>
                    <Row style={{ alignItems: 'center', margin: 'auto', whiteSpace: 'nowrap' }}>
                        <Card.Subtitle>
                            지역코드
                        </Card.Subtitle>
Spark's avatar
Spark committed
51
52
53
54
55
                        {logined &&
                            <Button variant='light' className='ml-1' style={btnstyled2}>
                                <Link to='/local_code' style={{ textDecoration: 'none', color: 'rgb(110, 189, 142)' }}>
                                    변경
                                </Link>
Spark's avatar
Spark committed
56
57
                            </Button>
                        }
58
                    </Row>
Spark's avatar
Spark committed
59
60
61
62
63
64
65
66
67
68
69
70
                    <Modal
                        show={localChange}
                        onHide={() => setLocalChange(false)}
                    >
                        <Modal.Header className='d-block text-center'>
                            <Modal.Title>
                                마이페이지
                            </Modal.Title>
                        </Modal.Header>
                        <Modal.Body>
                            지역이름 (지역코드)
                        </Modal.Body>
71
72
73
74
75
76
77
78
79
80
                    </Modal>

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