import React from 'react'; import { useParams, Navigate } from 'react-router-dom'; import { useStore } from '../src/context/StoreContext'; import BlogPostLayout from '../components/BlogPostLayout'; const ArticleDetail: React.FC = () => { const { slug } = useParams<{ slug: string }>(); const { articles } = useStore(); const article = articles.find(a => a.slug === slug); if (!article) { // You might want to show a 404 or just redirect back return ; } return (
{article.sections && article.sections.length > 0 ? ( article.sections.map((section: any) => (
{section.type === 'text' ? (

{section.content}

) : (
Article detail
)}
)) ) : (

No content available for this article yet.

)}
); }; export default ArticleDetail;