import React, { useEffect } from 'react'; import { motion } from 'framer-motion'; import { Link } from 'react-router-dom'; import { useStore } from '../src/context/StoreContext'; interface BlogPostLayoutProps { title: string; category: string; date: string; image: string; imageAlt: string; children: React.ReactNode; } const BlogPostLayout: React.FC = ({ title, category, date, image, imageAlt, children, }) => { const { articles } = useStore(); // Scroll to top on mount useEffect(() => { window.scrollTo(0, 0); }, []); const nextArticles = articles.filter(post => post.title !== title).slice(0, 2); return (
{/* Article Header */}
{category} {date}
{title} {/* Hero Image */} {imageAlt} {/* Content Container */}
{children}
{/* Read Next Section */} {nextArticles.length > 0 && (

Read Next

{nextArticles.map((post) => (
{post.title}

{post.title}

{post.category} {post.date}
))}
)} {/* Back Link */}
Back to Editorial
); }; export default BlogPostLayout;