"use client"; import type {ReactNode} from "react"; import type {LinkProps, SlotsToClasses} from "@heroui/react"; import React from "react"; import {usePostHog} from "posthog-js/react"; import {tv} from "tailwind-variants"; import {Card, CardHeader, CardBody} from "@heroui/react"; import {useRouter} from "next/navigation"; import {LinkIcon} from "@heroui/shared-icons"; const styles = tv({ slots: { base: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", card: "border-transparent bg-white/5 dark:bg-default-400/10 backdrop-blur-lg backdrop-saturate-[1.8]", header: "gap-2 pb-0", body: "", iconWrapper: "flex justify-center p-2 rounded-full items-center bg-secondary-100/80 text-pink-500", title: "text-base font-semibold", description: "font-normal text-medium text-default-500", }, }); export type FeaturesGridSlots = keyof ReturnType; export interface Feature extends LinkProps { title: string; icon: ReactNode; description?: string | ReactNode; } interface FeaturesGridProps { features: Feature[]; classNames?: SlotsToClasses; } export const FeaturesGrid: React.FC = ({features, classNames, ...props}) => { const router = useRouter(); const posthog = usePostHog(); const slots = styles(); const handleClick = (feat: Feature) => { posthog.capture("FeaturesGrid - Click", { name: feat.title, action: "click", category: "docs", data: feat.href ?? "", }); if (!feat.href) { return; } if (feat.isExternal) { window.open(feat.href, "_blank"); return; } router.push(feat.href); }; return (
{features.map((feat: Feature, index: number) => ( handleClick(feat)} >
{feat.icon}

{feat.title}

{feat.isExternal && }
{feat.description ? (

{feat.description}

) : null}
))}
); };