"use client" import React from "react" import Image from "next/image" import Link from "next/link" import { VariantProps, cva } from "class-variance-authority" import { ProjectInterface, ProjectLinkWebsite } from "@/lib/types" import { cn } from "@/lib/utils" import { useTranslation } from "@/app/i18n/client" import { LocaleTypes } from "@/app/i18n/settings" import { Icons } from "../icons" import { CategoryTag } from "../ui/categoryTag" import { ThemesButtonMapping } from "./project-filters-bar" import { ProjectLink } from "./project-link" interface ProjectCardProps extends React.HTMLAttributes, VariantProps { project: ProjectInterface showLinks?: boolean // show links in the card showBanner?: boolean // show images in the card } const TagsIconMapping: Record = { build: , play: , research: , } const projectCardVariants = cva( "flex cursor-pointer flex-col overflow-hidden rounded-lg transition duration-150 ease-in hover:scale-105", { variants: { showLinks: { true: "min-h-[450px]", false: "min-h-[200px]", }, border: { true: "border border-slate-900/20", }, }, } ) export default function ProjectCard({ project, showLinks = false, showBanner = false, border = false, className, lang, }: ProjectCardProps & { lang: LocaleTypes }) { const { t } = useTranslation(lang, "common") const { id, image, links, name, tldr, tags, imageAlt, projectStatus } = project const projectNotActive = projectStatus !== "active" return ( {showBanner && (
{`${name} {!image && ( {imageAlt || name} )}
)}
{tags?.themes?.map((theme, index) => { const { label } = ThemesButtonMapping(lang)?.[theme] const icon = TagsIconMapping?.[theme] return (
{icon} {label ?? theme}
) })}

{name}

{tldr}

{showLinks && (
{Object.entries(links ?? {})?.map(([website, url], index) => { return ( ) })}
)} {projectNotActive && ( {t("notCurrentlyActive")} )}
) }