import { useQuery } from '@tanstack/react-query'; import { Link } from '@tanstack/react-router'; import { fetchHeroArticle } from '@/lib/api'; import { Button } from '@/components/ui/button'; import { Calendar, User, ArrowRight, Eye } from 'lucide-react'; export function HeroArticle() { const { data: article, isLoading, error } = useQuery({ queryKey: ['hero-article'], queryFn: fetchHeroArticle, }); if (isLoading) { return (
); } if (error) { return (
ERROR
); } if (!article) { return (
?

NO HERO ARTICLE

Mark an article as "Hero" in the admin panel to feature it here.

This space will showcase your most important story
); } return (
{article.featuredImage && (
★ Featured Story
{article.title}
)}

{article.title}

{new Date(article.createdAt).toLocaleDateString('mk-MK', { day: 'numeric', month: 'short', year: 'numeric', })}
{article.author && (
{article.author.name}
)}
{article.views} views
{article.excerpt && (

{article.excerpt}

)} {article.tags && article.tags.length > 0 && (
{article.tags.map((tag) => ( #{tag} ))}
)}
{article.facebookShares + article.twitterShares + article.whatsappShares + article.telegramShares} shares
); }