All files / src/features/GiveSignup/components StepCard.tsx

75% Statements 3/4
100% Branches 10/10
50% Functions 1/2
75% Lines 3/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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81              1x                             83x 83x                                                                                                                  
import GiveText from "@shared/Text/GiveText";
import { CardContainer, IconContainer } from "../styles";
import { Box, Stack } from "@mui/material";
import { CheckIcon, IconProps } from "@phosphor-icons/react";
import { useAppTheme } from "@theme/v2/Provider";
import { HFGiveInput } from "@shared/HFInputs/HFGiveInput/HFGiveInput";
 
export const StepCard = ({
  Icon,
  title,
  onClick,
  description,
  isSelected,
  isOther,
}: {
  Icon?: React.ComponentType<IconProps>;
  title: string;
  onClick: any;
  description?: string;
  isSelected?: boolean;
  isOther?: boolean;
}) => {
  const { palette } = useAppTheme();
  return (
    <CardContainer
      onClick={onClick}
      sx={{
        border: isSelected ? `2px solid ${palette.border?.active}` : "none",
      }}
    >
      {!!Icon && (
        <IconContainer
          justifyContent="center"
          alignItems="center"
          display="flex"
        >
          <Icon width={24} height={24} />
        </IconContainer>
      )}
      <Stack gap="4px" sx={{ width: "100%" }}>
        <GiveText variant="bodyS">{title}</GiveText>
        {description && (
          <GiveText variant="bodyS" color="secondary">
            {description}
          </GiveText>
        )}
        {isOther && (
          <Box borderRadius="12px" bgcolor={palette.surface?.primary}>
            <HFGiveInput
              name="description"
              placeholder="Describe your business"
              multiline
              rows={6}
              fullWidth
              onClick={(e) => e.stopPropagation}
            />
          </Box>
        )}
      </Stack>
      {isSelected && (
        <Stack
          sx={{
            zIndex: "1",
            position: "absolute",
            right: "10px",
            top: "10px",
            background: palette.text.primary,
            width: "20px",
            height: "20px",
            borderRadius: "50%",
            alignItems: "center",
            justifyContent: "center",
          }}
        >
          <CheckIcon color="white" width={16} height={16} />
        </Stack>
      )}
    </CardContainer>
  );
};