"use client"; import { useState } from "react"; import SafeImage from "./SafeImage"; interface Experience { name: string; company: string; position: string; description: string; startDate: string; endDate: string; logo?: string; } interface ExperienceProps { experiences: Experience[]; } function formatDate(d: string) { if (d === "current") return "Present"; const [, m, y] = d.split("-"); const months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; return `${months[parseInt(m) - 1]} ${y}`; } function ExperienceItem({ exp, index }: { exp: Experience; index: number }) { const isCurrent = exp.endDate === "current"; return (
{/* Date */}
{isCurrent && (
● NOW
)} {formatDate(exp.startDate)}

{formatDate(exp.endDate)}
{/* Line with dot */}
{/* Content */}
{exp.logo && ( )} {exp.company}

{exp.position}

{exp.description}

); } export default function Experience({ experiences }: ExperienceProps) { const [showAll, setShowAll] = useState(false); return (
Career Path

Experience

{(showAll ? experiences : experiences.slice(0, 2)).map((exp, i) => (
))}
{experiences.length > 2 && (
)}
); }