ChartTabs.js 1.58 KB
Newer Older
Spark's avatar
chartjs    
Spark committed
1
2
3
4
5
6
7
import { useState } from "react";
import { Card, Row, Tab, Tabs } from "react-bootstrap";
import ChartTemp from './ChartTemp';
import ChartHumidity from './ChartHumidity';
import ChartWindSpeed from './ChartWindSpeed';
import ChartPressure from './ChartPressure';
import '../App.css'
Spark's avatar
Spark committed
8
9
import { getWeatherOut } from './../utils/CheckDB';
import { isLogined } from './../utils/Auth';
Spark's avatar
chartjs    
Spark committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

function ChartTabs() {

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


Spark's avatar
Spark committed
26
27
    //3743011 default

Spark's avatar
Spark committed
28
29
30

    const [key, setKey] = useState('temp');

Spark's avatar
chartjs    
Spark committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    return (
        <Row className='text-center w-100 my-2'>
            <Card style={cardstyled}>
                <Tabs
                    activeKey={key}
                    onSelect={(k) => setKey(k)}
                    className="mb-3" >
                    <Tab eventKey="temp" title="온도">
                        <ChartTemp />
                    </Tab>
                    <Tab eventKey="humidity" title="습도">
                        <ChartHumidity />
                    </Tab>
                    <Tab eventKey="windspeed" title="풍속">
                        <ChartWindSpeed />
                    </Tab>
                    <Tab eventKey="pressure" title="기압">
                        <ChartPressure />
                    </Tab>
                </Tabs>
            </Card>
        </Row>
    )
}

export default ChartTabs;