All files / src/shared/Tabs GiveProgressTab.tsx

0% Statements 0/5
0% Branches 0/18
0% Functions 0/2
0% Lines 0/4

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                                                                                                       
import { Stack } from "@mui/material";
import { GiveProgressTabProps } from "./GiveTab.types";
import SnackbarLinearProgress from "@shared/Snackbar/SnackbarLinearProgress";
import GiveText from "@shared/Text/GiveText";
import { CheckIcon, WarningIcon } from "@phosphor-icons/react";
import { useAppTheme } from "@theme/v2/Provider";
 
export default function GiveProgressTab({
  label,
  value,
  onClick,
  disabled,
  selected,
  hidden,
  progress,
  done,
  warning,
  hideMobileTitle,
}: GiveProgressTabProps) {
  const { palette } = useAppTheme();
  if (hidden) return null;
  return (
    <Stack
      direction="column"
      gap="12px"
      sx={{
        cursor: "pointer",
        flex: 1,
        ...(disabled && { pointerEvents: "none" }),
      }}
      onClick={() => onClick?.(value)}
    >
      <SnackbarLinearProgress progress={!progress || done ? 0 : progress} />
      {!hideMobileTitle && (
        <Stack direction="row" alignItems="center" gap="4px">
          {done && <CheckIcon color={palette.text.secondary} size={14} />}
          {warning && (
            <WarningIcon color={palette.primitive?.warning[50]} size={14} />
          )}
          <GiveText
            variant="bodyXS"
            color={selected ? "primary" : "secondary"}
            sx={{ ...(disabled && { color: palette.text.tertiary }) }}
          >
            {label}
          </GiveText>
        </Stack>
      )}
    </Stack>
  );
}