import type { ReactNode } from "react" import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "~/components/ui/card" import { cn } from "~/lib/utils" import { format } from 'date-fns' import type { ArrayElement } from "type-fest" import AnimateTextIn from "~/app/_components/Animated/AnimateIn" import AnimatedDiv from "~/app/_components/Animated/AnimatedDiv" import type { CvCategoryData } from "./CvCategory" export type CvEntryData = ArrayElement export default function CvEntry({ entry, description, className, position = 0 }: { entry: CvEntryData, description?: ReactNode, className?: string, position?: number }) { return ( {entry.title ? {entry.title} : <> } {entry.description ? {/* Fade the description in place instead of collapsing its height: the outer entry pop-up (CvCategory) measures height:auto when it plays, so the description must stay laid out at full height or the entry reveals too short. */}
{description ?? entry.description}
: <> } {!entry.hideDates ? {`von ${format(new Date(entry.fromTime), 'M. yyyy')} bis zum ${format(new Date(entry.toTime), 'M. yyyy')}`} : <> }
) }