LocCodeChange.js 4.34 KB
Newer Older
Spark's avatar
Spark committed
1
2
import React from 'react'
import '../App.css'
Spark's avatar
Spark committed
3
import { Form, Button, Row, Col, Card, DropdownButton, Dropdown, ButtonGroup } from 'react-bootstrap';
Spark's avatar
Spark committed
4
import { useState } from 'react';
Spark's avatar
Spark committed
5
6
import axios from 'axios';
// import { doeCode } from '../utils/Auth';
Spark's avatar
Spark committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

function LocCodeChange() {

    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',
        maxWidth: '80%',
        justifyContent: 'center',
        margin: 'auto',
        padding: '10px'
    }


    const btnstyled2 = {
        background: 'white',
        margin: '1px',
        maxWidth: 'fit-content',
        borderWidth: '2px',
        color: 'rgb(110, 189, 142)',
        borderColor: 'rgba(195, 195, 195, 0.753)',
        borderRadius: '20px'
    }

    const [locCodeShow, setLocCodeShow] = useState(false)

    function handleClickLoc() {
        setLocCodeShow(true);
        const auth = document.getElementById('loc-code')
        auth.style.visibility = 'visible'
    }

Spark's avatar
Spark committed
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    // console.log(typeof (locCode()))
    // console.log(locCode())
    // const [ddoe, setDdoe] = useState([])

    // async function DoeCode() {
    //     await doeCode().then((res) => {
    //         //     // // for (let i = 0; i < res.length; i++) {
    //         //     //     console.log(res[0]['code_doe'])
    //         //     //     console.log(0, res[0]['name_doe'])
    //         ddoe.push(res[0]['name_doe'])
    //         ddoe.push(res[1]['name_doe'])
    //         console.log(ddoe)
    //         console.log(typeof(ddoe))
    //         //     // }
    //     })
    // }
    
    const res = axios.get("localhost:4500/d/loccode");
    // const does = res.data["locCodes"]["DOE"]   // object


Spark's avatar
Spark committed
71
72
    return (
        <Row className='text-center w-100 my-2'>
Spark's avatar
Spark committed
73
74
75
76
77
            {/* {DoeCode()} */}
            {/* {data} */}

            asd

Spark's avatar
Spark committed
78
79
80
81
82
            <Card style={cardstyled}>
                <Card.Title id='impactTitle'>
                    Local Code
                </Card.Title>
                <Card.Subtitle style={{ fontWeight: 'lighter' }}>
Spark's avatar
Spark committed
83
                    Please select a your region
Spark's avatar
Spark committed
84
85
86
87
88
89
90
91
92
93
94
95
                </Card.Subtitle>
                <hr />
                <Card.Text>
                    <Form style={inboxstyled}>
                        <Row className='m-auto w-100 d-flex justify-content-center'>
                            <Col md={12} xs={12} style={{ padding: '0', display: 'flex', justifyContent: 'center', width: '100%' }}>
                                {['', '시군구', '읍면동'].map((localname) => (
                                    <DropdownButton
                                        variant='light'
                                        style={btnstyled2}
                                        title='지역코드'
                                        as={ButtonGroup}
Spark's avatar
Spark committed
96
                                        title={` ${localname} `}>
Spark's avatar
Spark committed
97
98

                                        <Dropdown.Item></Dropdown.Item>
Spark's avatar
Spark committed
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
                                        <Dropdown.Item>Another action</Dropdown.Item>
                                        <Dropdown.Item>Something else here</Dropdown.Item>
                                    </DropdownButton>
                                ))}
                                <Button variant='light' style={btnstyled2} onClick={!locCodeShow && handleClickLoc}>확인</Button>
                            </Col>
                            <Col md={6} xs={4} id='loc-code' style={{
                                margin: '5px',
                                border: 'solid',
                                borderColor: 'rgb(110, 189, 142)',
                                display: 'flex',
                                justifyContent: 'center',
                                padding: '2px',
                                visibility: 'hidden',
                                transition: 'all 4s'
                            }}>
                                지역코드
                            </Col>
                        </Row>

                    </Form>

                </Card.Text>
            </Card>

        </Row>
    )
}

export default LocCodeChange;