All files / src/pages/Login Footer.tsx

46.15% Statements 6/13
0% Branches 0/13
16.66% Functions 1/6
50% Lines 6/12

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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163                                  1x                                                                                                                                         1x                       1x                               1x                                                                   1x 1x                          
import Logo from "@assets/icons/RebrandedIcons/LogoBlueAccent";
import { Text } from "@common/Text";
import { ITextProps } from "@common/Text/Text";
import { SxProps } from "@mui/material";
import { Grid, Link, Stack, StackProps, styled } from "@mui/material";
import { palette } from "@palette";
import { useCustomTheme } from "@theme/hooks/useCustomTheme";
import useCheckEnvironment from "@hooks/common/useCheckEnvironment";
import { POLICY_PATHS } from "@routes/paths";
 
interface Props extends StackProps {
  color?: string;
  hideSupport?: boolean;
  hideLogo?: boolean;
  linkGoupeWrapperStyle?: StackProps["sx"];
}
 
const Footer = ({
  color = palette.black[100],
  linkGoupeWrapperStyle,
  hideSupport,
  hideLogo,
  ...rest
}: Props) => {
  const { isMobileView } = useCustomTheme();
  const { platformBaseUrl } = useCheckEnvironment();
 
  return (
    <Stack
      width="100%"
      flexDirection="row"
      alignItems="end"
      justifyContent="space-between"
      display="flex"
      padding="25px 16px"
    >
      <StyledContainer {...rest}>
        <StyledText color={color}>
          All rights reserved ©GiveCorporation {new Date().getFullYear()}
        </StyledText>
        {isMobileView || hideLogo ? null : (
          <Grid paddingLeft="110px">
            <Text textAlign="center">Powered by</Text>
            <Logo height={14} />
          </Grid>
        )}
        <Stack
          gap={{
            xs: "8px",
            md: 3,
          }}
          direction={{
            xs: "column",
            md: "row",
          }}
          sx={linkGoupeWrapperStyle}
        >
          {!hideSupport && (
            <StyledAnchor
              href="mailto:support@givepayments.com"
              underline={palette.black[100]}
            >
              <StyledText color={color}>Support</StyledText>
            </StyledAnchor>
          )}
          <LoginLink underline={palette.black[100]} href={`${platformBaseUrl}/${POLICY_PATHS.PRIVACY}`}>
            <StyledText color={color}>Privacy Policy</StyledText>
          </LoginLink>
          <LoginLink
            underline={palette.black[100]}
            href={`${platformBaseUrl}/${POLICY_PATHS.TERMS_OF_SERVICE}`}
          >
            <StyledText color={color}>Terms &amp; Conditions</StyledText>
          </LoginLink>
          <LoginLink
            underline={palette.black[100]}
            href={`${platformBaseUrl}/${POLICY_PATHS.SLA}`}
          >
            <StyledText color={color}>SLA</StyledText>
          </LoginLink>
        </Stack>
      </StyledContainer>
    </Stack>
  );
};
 
const StyledContainer = styled(Stack)(({ theme }) => ({
  width: "100%",
  display: "flex",
  flexDirection: "row",
 
  justifyContent: "space-between",
  [theme.breakpoints.down("sm")]: {
    gap: "10px",
    flexDirection: "column-reverse",
  },
}));
 
const StyledText = styled(Text)<ITextProps & { color?: string }>(
  ({ theme, color }) => ({
    fontSize: 14,
    fontWeight: 400,
    lineHeight: "18.9px",
    color: color || palette.black[100],
 
    [theme.breakpoints.down("sm")]: {
      lineHeight: "16.8px",
      fontWeight: 350,
    },
  }),
);
 
export default Footer;
 
const LoginLink = ({
  children,
  href,
  underline,
  sx,
}: {
  children: React.ReactNode;
  href: string;
  underline: string;
  sx?: SxProps;
}) => {
  return (
    <Link
      underline="none"
      color="inherit"
      href={href}
      target="_blank"
      width="fit-content"
      sx={{
        ...(underline && {
          "&:hover": {
            textDecoration: "underline",
            color: underline,
            cursor: "pointer",
          },
        }),
        ...sx,
      }}
    >
      {children}
    </Link>
  );
};
 
const StyledAnchor = styled("a", {
  shouldForwardProp: (prop) => prop !== "underline",
})<{ underline?: string }>(({ underline }) => ({
  textDecoration: "none",
  color: "inherit",
  width: "fit-content",
  "&:hover": {
    ...(underline && {
      textDecoration: "underline",
      color: underline,
      cursor: "pointer",
    }),
  },
}));