All files / src/components/common/Modal/ModalDrawer ModalDrawerHeader.tsx

50% Statements 2/4
0% Branches 0/3
0% Functions 0/2
66.66% Lines 2/3

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                        4x                                                         4x                            
import { Text } from "@common/Text";
import { Box, styled } from "@mui/material";
import { palette } from "@palette";
import { GridIcon } from "@assets/icons/RebrandedIcons";
import { CloseIcon } from "@assets/rebrandIcons";
import { IconButton } from "@common/IconButton";
 
export type HeaderProps = {
  title?: string;
  Icon?: JSX.Element;
};
 
const ModalDrawerHeader = ({
  title,
  Icon = <GridIcon />,
  onModalClose,
}: HeaderProps & { onModalClose?: () => void }) => {
 
  return (
    <HeaderWrapper>
      {Icon}
      <Text
        variant="body"
        lineHeight="16.8px"
        color={palette.gray[300]}
        flexGrow={1}
      >
        {title}
      </Text>
      {onModalClose && (
        <IconButton
          onClick={onModalClose}
          variant="text"
        >
          <CloseIcon width={24} height={24} />
        </IconButton>
      )}
    </HeaderWrapper>
  );
}
 
const HeaderWrapper = styled(Box)(() => ({
  display: "flex",
  width: "100%",
  padding: "16px 16px 8px 16px",
  flexDirection: "row",
  alignItems: "center",
  gap: "8px",
  background: "rgba(251, 251, 251, 0.80)",
  boxShadow: "0px 5px 10px 0px rgba(0, 0, 0, 0.05)",
  backdropFilter: "blur(20px)",
  marginBottom: "12px",
}));
 
export default ModalDrawerHeader;