All files / src/componentsV2/AccountProfile/AccountProfileModal ProfileModalSidebar.tsx

88.88% Statements 8/9
100% Branches 2/2
83.33% Functions 5/6
100% Lines 7/7

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                          1x 11x         44x                   1x 133x 44x                       11x                    
import { Box, Stack } from "@mui/material";
import { TProfileTab } from "./types";
import { Icon } from "@phosphor-icons/react";
import { styled } from "@theme/v2/Provider";
import GiveText from "@shared/Text/GiveText";
import { TextProps } from "@shared/Text/giveText.types";
import ProfileModalHeader from "./ProfileModalHeader";
 
type Props = {
  sidebarList: { tab: TProfileTab; icon: Icon; active: boolean }[];
  handleSelectTab: (tab: TProfileTab) => void;
};
 
const ProfileModalSidebar = ({ sidebarList, handleSelectTab }: Props) => {
  return (
    <Container>
      <ProfileModalHeader />
      <Stack spacing={1.5}>
        {sidebarList.map(({ icon: Icon, tab, active }) => (
          <Tab key={tab} active={active} onClick={() => handleSelectTab(tab)}>
            <Icon size={18} />
            <GiveText variant="bodyS">{tab}</GiveText>
          </Tab>
        ))}
      </Stack>
    </Container>
  );
};
 
const Tab = styled(Box, {
  shouldForwardProp: (prop) => prop !== "active",
})<TextProps & { active: boolean }>(({ active, theme }) => ({
  display: "flex",
  alignItems: "center",
  gap: "8px",
  cursor: "pointer",
  borderRadius: "8px",
  padding: "10px 12px",
  ...(active && {
    background: theme.palette.primitive?.transparent?.["darken-10"],
  }),
}));
 
const Container = styled(Box)(() => ({
  padding: "40px 12px 40px 12px",
  background: "inherit",
  height: "100%",
  display: "flex",
  flexDirection: "column",
  gap: "16px",
}));
 
export default ProfileModalSidebar;