All files / src/apps/containers/components ContainerOwnerTabs.tsx

33.33% Statements 2/6
100% Branches 0/0
0% Functions 0/3
33.33% Lines 2/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                      1x             1x                                                                          
import React from "react";
import { Tab, Tabs } from "@mui/material";
import { Link } from "react-router-dom";
import { TabType } from "../types";
import { makeStyles } from "@mui/styles";
 
interface Props {
  currentPageUrl: string;
  tabList: TabType[];
}
 
const useStyles = makeStyles({
  fullWidth: {
    width: "100%",
    color: "black"
  }
});
 
const ContainerOwnerTabs: React.FC<Props> = ({ currentPageUrl, tabList }) => {
  const classes = useStyles();
 
  return (
    <Tabs
      // centered
      className={classes.fullWidth}
      indicatorColor="secondary"
      variant="fullWidth"
      value={currentPageUrl}
      data-testid="tabs"
    >
      {tabList.map(({ labelName, labelURL }, index) => (
        <LinkTab
          key={index}
          label={labelName}
          value={labelURL}
          to={labelURL}
          data-testid={"tab - " + index}
        />
      ))}
      ;
    </Tabs>
  );
};
 
interface LinkTabProps {
  label: string;
  value: string;
  to: string;
}
 
function LinkTab(props: LinkTabProps) {
  return <Tab component={Link} {...props} />;
}
 
export default ContainerOwnerTabs;