import React, { useState, useEffect } from 'react'; import { useParams, Link } from 'react-router-dom'; import { ArrowLeft, Clock, Share2, Bookmark } from 'lucide-react'; import { Header } from '../components/Header'; import { ReactionButtons } from '../components/ReactionButtons'; import { PhotoGallery } from '../components/PhotoGallery'; import { articles } from '../data/mock'; import { Article } from '../types'; export function ArticlePage() { const { id } = useParams(); const [articleData, setArticleData] = useState
( articles.find(a => a.id === id) ); useEffect(() => { window.scrollTo(0, 0); }, [id]); if (!articleData) { return (

Article not found

Return to homepage
); } const handleReaction = (reaction: 'like' | 'dislike') => { setArticleData(prev => { if (!prev) return prev; const newArticle = { ...prev }; if (prev.userReaction === 'like') newArticle.likes--; if (prev.userReaction === 'dislike') newArticle.dislikes--; if (prev.userReaction !== reaction) { if (reaction === 'like') newArticle.likes++; if (reaction === 'dislike') newArticle.dislikes++; newArticle.userReaction = reaction; } else { newArticle.userReaction = null; } return newArticle; }); }; return (
Back to articles
{/* Article Header */}
{articleData.author.name}

{articleData.author.name}

{articleData.readTime} min read ยท{' '} {new Date(articleData.publishedAt).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric', })}

{articleData.title}

{articleData.excerpt}

{articleData.category}
{/* Cover Image */} {articleData.title} {/* Article Content */}
{articleData.content}

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

"Art is not what you see, but what you make others see." - Edgar Degas

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

{/* Photo Gallery */} {articleData.gallery && articleData.gallery.length > 0 && (

Photo Gallery

)} {/* Article Footer */}
); }