'use client' import { Badge } from '@/components/ui/badge' import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card' import { cn } from '@/lib/utils' import { BadgeListBlock, Media } from '@/payload-types' import { DefaultTypedEditorState } from '@payloadcms/richtext-lexical' import Image from 'next/image' import Link from 'next/link' import { RichText } from './RichText' import clsx from 'clsx' type Props = { title: string href?: string description?: DefaultTypedEditorState dates: string tags?: BadgeListBlock[] link?: string image?: Media video?: Media links?: BadgeListBlock[] className?: string } export function ProjectCard({ title, href, description, dates, link, image, video, className, ...rest }: Props) { const tags = rest?.tags?.length ? rest.tags[0] : null const links = rest?.links?.length ? rest.links[0] : null return (
{title}
{link?.replace('https://', '').replace('www.', '').replace('/', '')}
{!!description && ( )}
{tags?.badges && tags.badges.length > 0 && (
{tags.badges.map((b, i) => ( {b.value} ))}
)}
{links?.badges && links.badges.length > 0 && (
{links.badges?.map((link, idx) => { const icon = link.icon as Media | undefined return ( {!!icon && icon.url && ( {icon.alt )} {link.value} ) })}
)}
) }