"use client"; import { ArrowLeft, Eye, Github, Twitter } from "lucide-react"; import Link from "next/link"; import React, { useEffect, useRef, useState } from "react"; type Props = { project: { url?: string; title: string; description: string; repository?: string; }; views: number; }; export const Header: React.FC = ({ project, views }) => { const ref = useRef(null); const [isIntersecting, setIntersecting] = useState(true); const links: { label: string; href: string }[] = []; if (project.repository) { links.push({ label: "GitHub", href: `https://github.com/${project.repository}`, }); } if (project.url) { links.push({ label: "Website", href: project.url, }); } useEffect(() => { if (!ref.current) return; const observer = new IntersectionObserver(([entry]) => setIntersecting(entry.isIntersecting), ); observer.observe(ref.current); return () => observer.disconnect(); }, []); return (
{" "} {Intl.NumberFormat("en-US", { notation: "compact" }).format( views, )}

{project.title}

{project.description}

{links.map((link) => ( {link.label} ))}
); };