ChartTabs.js 1.48 KB
Newer Older
Spark's avatar
chartjs    
Spark committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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'

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'
    }

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

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

Spark's avatar
chartjs    
Spark committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    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;