import React, { useEffect, useState } from "react"; import Link from "next/link"; interface Project { slug: string; id: string; title: string; feature_image: string; visibility: string; published_at: string; updated_at: string; html: string; reading_time: number; meta_description: string; } export default function Projects() { const [projects, setProjects] = useState([]); const [isVisible, setIsVisible] = useState(false); useEffect(() => { const fetchProjects = async () => { try { const response = await fetch("/api/fetchAllProjects"); if (!response.ok) { throw new Error("Failed to fetch projects from Ghost"); } const projectsData = await response.json(); setProjects(projectsData.posts); setTimeout(() => { setIsVisible(true); }, 250); // Delay to start the animation after Hero } catch (error) { console.error("Failed to fetch projects:", error); } }; fetchProjects(); }, []); console.log(projects.at(0)?.feature_image); const numberOfProjects = projects.length; return (

Projects

{projects.map((project, index) => (

{project.title}

{project.meta_description}

))}

More to come

...

); }