import { Button, Flex, Grid, Heading } from "@chakra-ui/react"; import type { FunctionComponent } from "react"; import { HOME_ANALYTICS, SECTION_PADDING } from "./constants"; import testIds from "./testIds"; import { useSection } from "./useSection"; import { CatalogSearchSort } from "../../api/catalog-search/constants"; import { DEFAULT_FEATURED_PACKAGES } from "../../api/config"; import { NavLink } from "../../components/NavLink"; import { PackageCard } from "../../components/PackageCard"; import { eventName } from "../../contexts/Analytics"; import { useConfigValue } from "../../hooks/useConfigValue"; import { getSearchPath } from "../../util/url"; export const Featured: FunctionComponent = () => { const homePackages = useConfigValue("featuredPackages"); const [featured = { name: "Recently Updated", showLastUpdated: 4 }] = ( homePackages ?? DEFAULT_FEATURED_PACKAGES ).sections; const section = useSection(featured); if (!section) { return null; } return ( {featured.name} {section?.slice(0, 4).map((pkg) => ( ))} ); };