import { Box, makeStyles, Tab, Tabs, Theme } from '@material-ui/core'; import { FC, useState } from 'react'; import { ITabListProps, ITabPanel } from './Types'; const useStyles = makeStyles((theme: Theme) => ({ wrapper: { '& .MuiTab-wrapper': { textTransform: 'capitalize', fontWeight: 'bold', color: '#323232', }, }, tab: { height: theme.spacing(0.5), backgroundColor: theme.palette.primary.main, }, tabContainer: { borderBottom: '1px solid #e9e9ed', }, tabContent: { minWidth: 0, marginRight: theme.spacing(3), }, tabPanel: { flexBasis: 0, flexGrow: 1, marginTop: theme.spacing(2), overflowY: 'auto', }, })); const TabPanel = (props: ITabPanel) => { const { children, value, index, className = '', ...other } = props; return ( ); }; const a11yProps = (index: number) => { return { id: `tab-${index}`, 'aria-controls': `tabpanel-${index}`, }; }; const CustomTabList: FC = props => { const { tabs, activeIndex = 0, handleTabChange, wrapperClass = '' } = props; const classes = useStyles(); const [value, setValue] = useState(activeIndex); const handleChange = (event: any, newValue: any) => { setValue(newValue); handleTabChange && handleTabChange(newValue); }; return ( <> }} value={value} onChange={handleChange} aria-label="tabs" > {tabs.map((tab, index) => ( ))} {tabs.map((tab, index) => ( {tab.component} ))} ); }; export default CustomTabList;