import React from 'react';
import { Link } from 'react-router-dom';
import { motion } from 'framer-motion';
import { useStore } from '../src/context/StoreContext';
const Editorial: React.FC = () => {
const { articles, isLoading } = useStore();
if (isLoading) return
Loading Journal...
;
if (!articles || articles.length === 0) {
return (
Editorial
No stories yet. Stay tuned!
);
}
// Sort: Featured first, then rest
const featuredArticle = articles.find(a => a.isFeatured) || articles[0];
const otherArticles = articles.filter(a => a.id !== featuredArticle.id);
return (
{/* Featured Post */}
{featuredArticle.category}
{featuredArticle.date}
{featuredArticle.title}
{featuredArticle.description}
Read Story
{/* Other Articles Grid */}
{otherArticles.map((entry, idx) => (
{entry.category}
{entry.date}
{entry.title}
{entry.description}
))}
);
};
export default Editorial;