All files / app/features/press PressCoverage.tsx

100% Statements 18/18
100% Branches 2/2
100% Functions 7/7
100% Lines 15/15

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 1482x 2x 2x   2x 2x   2x                                                                             2x 62x 12x                 4x                           12x                     12x               4x 4x                                 12x                                                                              
import { Box, Card, Link, styled, Typography } from "@mui/material";
import { useTranslation } from "i18n";
import { PRESS } from "i18n/namespaces";
 
import SectionHeading from "./SectionHeading";
import SectionWrapper from "./SectionWrapper";
 
const articlesData = [
  {
    imgPath: "/img/press/travel-noir-logo.webp",
    altText: "Travel Noir",
    bgColor: "#001d2e",
    padding: "1rem",
    publishedDate: "April 1, 2025",
    dateTime: "2025-04-01",
    headline:
      "Couchsurfing vs. house sitting: how to stay for free around the world",
    href: "https://travelnoire.com/couchsurfing-house-sitting-travel",
  },
  {
    imgPath: "/img/press/adventure-uncovered.svg",
    altText: "Adventure Uncovered",
    bgColor: "#1d1d1d",
    padding: "1rem",
    publishedDate: "October 6, 2022",
    dateTime: "2022-10-06",
    headline: "The couchsurfing crossroads",
    href: "https://adventureuncovered.com/stories/the-couchsurfing-crossroads/",
  },
  {
    imgPath: "/img/press/input-logo.svg",
    altText: "Input",
    bgColor: undefined,
    padding: undefined,
    publishedDate: "September 15, 2021",
    dateTime: "2021-09-15",
    headline: "Paradise lost: The rise and ruin of Couchsurfing.com",
    href: "https://www.inverse.com/input/features/rise-and-ruin-of-couchsurfing",
  },
];
 
interface StyledImageProps {
  bgColor?: string;
  padding?: string;
}
 
const StyledImage = styled("img", {
  shouldForwardProp: (prop) => prop !== "bgColor" && prop !== "padding",
})<StyledImageProps>(({ bgColor, padding }) => ({
  width: "auto",
  height: "4rem",
  objectFit: "cover",
  backgroundColor: bgColor,
  padding: padding,
  borderRadius: "4px",
}));
 
const StyledContainer = styled("div")(({ theme }) => ({
  display: "grid",
  gridTemplateColumns: "1fr",
  gap: "1rem",
 
  [theme.breakpoints.up("md")]: {
    gridTemplateColumns: "1fr 1fr",
  },
 
  [theme.breakpoints.up("lg")]: {
    gridTemplateColumns: "1fr 1fr 1fr",
  },
}));
 
const StyledCard = styled(Card)(({ theme }) => ({
  display: "grid",
  gridRow: "span 4",
  gridTemplateRows: "subgrid",
  padding: "1rem",
 
  [theme.breakpoints.up("md")]: {
    padding: "1.5rem",
  },
}));
 
const StyledLink = styled(Link)(({ theme }) => ({
  justifySelf: "center",
 
  [theme.breakpoints.up("sm")]: {
    justifySelf: "start",
  },
}));
 
export default function PressCoverage() {
  const { t } = useTranslation([PRESS]);
 
  return (
    <SectionWrapper>
      <SectionHeading>{t("press_coverage_subheading")}</SectionHeading>
      <StyledContainer>
        {articlesData.map(
          ({
            imgPath,
            altText,
            bgColor,
            padding,
            publishedDate,
            dateTime,
            headline,
            href,
          }) => (
            <StyledCard key={altText}>
              <Box
                sx={{
                  margin: "0 auto",
                }}
              >
                <StyledImage
                  src={imgPath}
                  alt={altText}
                  loading="lazy"
                  bgColor={bgColor}
                  padding={padding}
                />
              </Box>
              <Typography component="time" dateTime={dateTime}>
                {publishedDate}
              </Typography>
              <Typography
                sx={{
                  fontSize: "1.25rem",
                }}
              >
                "{headline}"
              </Typography>
              <StyledLink
                href={href}
                aria-label={t("read_more_link_aria", { headline })}
                target="_blank"
                rel="noopener noreferrer"
              >
                {t("read_more")}
              </StyledLink>
            </StyledCard>
          ),
        )}
      </StyledContainer>
    </SectionWrapper>
  );
}