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; } interface ProjectsData { posts: Project[]; } 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) { console.error(`Failed to fetch projects: ${response.statusText}`); return []; } const projectsData = (await response.json()) as ProjectsData; setProjects(projectsData.posts); setTimeout(() => { setIsVisible(true); }, 250); // Delay to start the animation after Hero } catch (error) { console.error("Failed to fetch projects:", error); } }; fetchProjects(); }, []); const numberOfProjects = projects.length; return (

Projects

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

{project.title}

{project.meta_description}

))}

More to come

...

); }