xxxxxxxxxx
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
<meta charset="utf-8" />
5
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
<meta name="viewport" content="width=device-width, initial-scale=1" />
7
<meta name="theme-color" content="#000000" />
8
<meta
9
name="description"
10
content="Web site created using create-react-app"
11
/>
12
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
<link
14
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
15
rel="stylesheet"
16
/>
17
<link
18
href="https://use.fontawesome.com/releases/v5.15.1/css/all.css"
19
rel="stylesheet"
20
/>
21
22
<!--
23
manifest.json provides metadata used when your web app is installed on a
24
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
25
-->
26
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
27
<!--
28
Notice the use of %PUBLIC_URL% in the tags above.
29
It will be replaced with the URL of the `public` folder during the build.
30
Only files inside the `public` folder can be referenced from the HTML.
31
32
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
33
work correctly both with client-side routing and a non-root public URL.
34
Learn how to configure a non-root public URL by running `npm run build`.
35
-->
36
<title>MDBReact5 Template App</title>
37
</head>
38
<body>
39
<noscript>You need to enable JavaScript to run this app.</noscript>
40
<div id="root"></div>
41
<!--
42
This HTML file is a template.
43
If you open it directly in the browser, you will see an empty page.
44
45
You can add webfonts, meta tags, or analytics to this file.
46
The build step will place the bundled scripts into the <body> tag.
47
48
To begin the development, run `npm start` or `yarn start`.
49
To create a production bundle, use `npm run build` or `yarn build`.
50
-->
51
</body>
52
</html>
53
xxxxxxxxxx
1
body {
2
margin: 0;
3
font-family: Roboto, Helvetica, Arial, sans-serif;
4
-webkit-font-smoothing: antialiased;
5
-moz-osx-font-smoothing: grayscale;
6
}
7
8
code {
9
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
10
monospace;
11
}
12
xxxxxxxxxx
1
import React, { useState } from 'react';
2
import {
3
MDBContainer,
4
MDBRow,
5
MDBCard,
6
MDBCol,
7
MDBDatepicker,
8
MDBSelectDeprecated,
9
MDBCardBody,
10
MDBBtn,
11
MDBIcon,
12
MDBChart,
13
MDBCardHeader,
14
MDBCardFooter,
15
MDBTabs,
16
MDBTabsPane,
17
MDBTabsContent,
18
MDBTabsItem,
19
MDBTabsLink
20
} from 'mdb-react-ui-kit';
21
22
function App() {
23
const [fillActive, setFillActive] = useState('pill-1');
24
25
const handleFillClick = (value: string) => {
26
if (value === fillActive) {
27
return;
28
}
29
30
setFillActive(value);
31
};
32
33
return (
34
<MDBContainer fluid>
35
<MDBRow className='justify-content-center'>
36
<MDBCol md='8'>
37
<section>
38
<MDBCard>
39
<MDBCardHeader className='py-3'>
40
<MDBTabs pills fill className='mb-3'>
41
<MDBTabsItem>
42
<MDBTabsLink onClick={() => handleFillClick('pill-1')} active={fillActive === 'pill-1'}>
43
Panel 1
44
</MDBTabsLink>
45
</MDBTabsItem>
46
<MDBTabsItem>
47
<MDBTabsLink onClick={() => handleFillClick('pill-2')} active={fillActive === 'pill-2'}>
48
Panel 2
49
</MDBTabsLink>
50
</MDBTabsItem>
51
<MDBTabsItem>
52
<MDBTabsLink onClick={() => handleFillClick('pill-3')} active={fillActive === 'pill-3'}>
53
Panel 3
54
</MDBTabsLink>
55
</MDBTabsItem>
56
</MDBTabs>
57
</MDBCardHeader>
58
59
<MDBCardBody>
60
<MDBTabsContent>
61
<MDBTabsPane show={fillActive === 'pill-1'} aria-labelledby='pill-1'>
62
<MDBChart
63
type='bar'
64
data={{
65
labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
66
datasets: [
67
{
68
label: 'Traffic',
69
data: [2112, 2343, 2545, 3423, 2365, 1985, 987],
70
},
71
],
72
}}
73
options={{
74
indexAxis: 'y',
75
scales: {
76
x: {
77
stacked: true,
78
grid: {
79
display: true,
80
drawBorder: true,
81
},
82
ticks: {
83
color: 'rgba(0,0,0, 0.5)',
84
},
85
},
86
y: {
87
stacked: true,
88
grid: {
89
display: false,
90
drawBorder: false,
91
},
92
ticks: {
93
color: 'rgba(0,0,0, 0.5)',
94
},
95
},
96
},
97
}}
98
/>
99
</MDBTabsPane>
100
<MDBTabsPane show={fillActive === 'pill-2'} aria-labelledby='pill-2'>
101
<MDBChart
102
type='pie'
103
data={{
104
labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
105
datasets: [
106
{
107
label: 'Traffic',
108
data: [2112, 2343, 2545, 3423, 2365, 1985, 987],
109
backgroundColor: [
110
'rgba(63, 81, 181, 0.5)',
111
'rgba(77, 182, 172, 0.5)',
112
'rgba(66, 133, 244, 0.5)',
113
'rgba(156, 39, 176, 0.5)',
114
'rgba(233, 30, 99, 0.5)',
115
'rgba(66, 73, 244, 0.4)',
116
'rgba(66, 133, 244, 0.2)',
117
],
118
},
119
],
120
}}
121
/>
122
</MDBTabsPane>
123
<MDBTabsPane show={fillActive === 'pill-3'} aria-labelledby='pill-3'>
124
<MDBChart
125
type='polarArea'
126
data={{
127
labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
128
datasets: [
129
{
130
label: 'Traffic',
131
data: [2112, 2343, 2545, 3423, 2365, 1985, 987],
132
backgroundColor: [
133
'rgba(63, 81, 181, 0.5)',
134
'rgba(77, 182, 172, 0.5)',
135
'rgba(66, 133, 244, 0.5)',
136
'rgba(156, 39, 176, 0.5)',
137
'rgba(233, 30, 99, 0.5)',
138
'rgba(66, 73, 244, 0.4)',
139
'rgba(66, 133, 244, 0.2)',
140
],
141
},
142
],
143
}}
144
/>
145
</MDBTabsPane>
146
</MDBTabsContent>
147
</MDBCardBody>
148
</MDBCard>
149
</section>
150
</MDBCol>
151
</MDBRow>
152
</MDBContainer>
153
);
154
}
155
156
export default App;
157
Console errors: 0