All files / src/features/Minibuilders/MembershipsMinibuilder MembershipsConfiguration.tsx

50% Statements 3/6
0% Branches 0/4
0% Functions 0/3
60% Lines 3/5

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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127                              4x                                                                                                                                                         4x                                       4x                            
import { Stack } from "@mui/material";
import { RHFCheckbox } from "@common/Checkbox";
import { Text } from "@common/Text";
import { palette } from "@palette";
import { ComingSoonTag } from "@common/Tag";
import { styled } from "@mui/material";
import { RHFCustomIntegerInput } from "@common/CustomIntegerInput";
import FadeUpWrapper from "@components/animation/FadeUpWrapper";
 
type ConfigurationSectionProps = {
  title: string;
  titleSize?: "large" | "medium";
  isEdit?: boolean;
};
 
const MembershipsConfiguration = ({
  title,
  titleSize = "large",
  isEdit = false,
}: ConfigurationSectionProps) => {
  return (
    <Stack direction="column" gap={isEdit ? 2 : 4} flexGrow={1}>
      <FadeUpWrapper delay={200}>
        <Stack direction="column" gap={2}>
          <Text
            color={palette.black[100]}
            variant="headline"
            fontWeight="book"
            fontSize="18px"
            lineHeight="21.6px"
            sx={{ letterSpacing: "-0.18" }}
          >
            Payment form
          </Text>
          <MaxSubscriptionsInput />
        </Stack>
      </FadeUpWrapper>
      <FadeUpWrapper delay={300}>
        <Stack direction="column" gap={2}>
          <Text
            color={palette.black[100]}
            variant="headline"
            fontWeight="book"
            fontSize="18px"
            lineHeight="21.6px"
            sx={{ letterSpacing: "-0.18" }}
          >
            Customer
          </Text>
          <RHFCheckbox
            name="configuration.customer_pays_fees"
            label="Customer pays the credit card fee"
            sx={{
              "& .MuiButtonBase-root.MuiCheckbox-root": {
                height: 24,
              },
            }}
          />
          <Stack direction="column">
            <Stack
              direction="row"
              alignItems="center"
              justifyContent="space-between"
            >
              <RHFCheckbox
                disabled
                name="configuration.browse_more"
                label="Browse more Payment forms"
                sx={{
                  "& .MuiButtonBase-root.MuiCheckbox-root": {
                    height: 24,
                  },
                }}
              />
              <ComingSoonTag />
            </Stack>
            <Text
              color={palette.gray[300]}
              fontSize="16px"
              fontWeight="book"
              lineHeight="19.2px"
              ml={4}
            >
              Allow users to explore more of your published Payment forms.
            </Text>
          </Stack>
        </Stack>
      </FadeUpWrapper>
    </Stack>
  );
};
 
const MaxSubscriptionsInput = () => {
  return (
    <SubscriptionsInput>
      <Text
        variant="body"
        color={palette.black[100]}
        fontSize="16px"
        lineHeight="19.2px"
        fontWeight="book"
      >
        Max subscriptions that can be purchased at once
      </Text>
      <RHFCustomIntegerInput
        name="configuration.max_subscriptions"
        width="82px"
      />
    </SubscriptionsInput>
  );
};
 
const SubscriptionsInput = styled(Stack)(({ theme }) => ({
  padding: "8px",
  gap: "8px",
  borderRadius: "8px",
  background: palette.liftedWhite[100],
 
  [theme.breakpoints.up("sm")]: {
    flexDirection: "row",
    justifyContent: "space-between",
    alignItems: "center",
  },
}));
 
export default MembershipsConfiguration;