-
Notifications
You must be signed in to change notification settings - Fork 54
/
tabpanel.js
38 lines (32 loc) · 977 Bytes
/
tabpanel.js
1
2
3
4
5
6
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
import React from "react";
import PropTypes from "prop-types";
import { Box } from "@material-ui/core";
import { makeStyles } from "@material-ui/core/styles";
const useStyles = makeStyles({
tabpanel: { height: "100%" },
tabpanelContent: { height: "100%" },
});
function TabPanel(props) {
const classes = useStyles();
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
className={classes.tabpanel}
hidden={value !== index}
id={`scrollable-auto-tabpanel-${index}`}
aria-labelledby={`scrollable-auto-tabpanel-${index}`}
{...other}
>
{value === index && (
<Box className={classes.tabpanelContent}>{children}</Box>
)}
</div>
);
}
TabPanel.propTypes = {
children: PropTypes.node,
index: PropTypes.any.isRequired,
value: PropTypes.any.isRequired,
};
export default TabPanel;