import React from "react"; // nodejs library that concatenates classes import classNames from "classnames"; // nodejs library to set properties for components import PropTypes from "prop-types"; // material-ui components import { makeStyles } from "@material-ui/core/styles"; import Tabs from "@material-ui/core/Tabs"; import Tab from "@material-ui/core/Tab"; import Icon from "@material-ui/core/Icon"; // core components import Card from "components/Card/Card.js"; import CardBody from "components/Card/CardBody.js"; import CardHeader from "components/Card/CardHeader.js"; import styles from "assets/jss/nextjs-material-kit/components/customTabsStyle.js"; const useStyles = makeStyles(styles); export default function CustomTabs(props) { const [value, setValue] = React.useState(0); const handleChange = (event, value) => { setValue(value); }; const classes = useStyles(); const { headerColor, plainTabs, tabs, title, rtlActive } = props; const cardTitle = classNames({ [classes.cardTitle]: true, [classes.cardTitleRTL]: rtlActive }); return ( {title !== undefined ?
{title}
: null} {tabs.map((prop, key) => { var icon = {}; if (prop.tabIcon) { icon = { icon: typeof prop.tabIcon === "string" ? ( {prop.tabIcon} ) : ( ) }; } return ( ); })}
{tabs.map((prop, key) => { if (key === value) { return
{prop.tabContent}
; } return null; })}
); } CustomTabs.propTypes = { headerColor: PropTypes.oneOf([ "warning", "success", "danger", "info", "primary", "rose" ]), title: PropTypes.string, tabs: PropTypes.arrayOf( PropTypes.shape({ tabName: PropTypes.string.isRequired, tabIcon: PropTypes.object, tabContent: PropTypes.node.isRequired }) ), rtlActive: PropTypes.bool, plainTabs: PropTypes.bool };