import { useQuery } from '@tanstack/react-query' import { Link } from '@tanstack/react-router' import * as api from '@/lib/api' import { SocialShareButtons } from '@/components/features/social-share' import { ArrowRight } from 'lucide-react' export function LatestArticlesGrid() { const { data, isLoading, error } = useQuery({ queryKey: ['latest-articles'], queryFn: () => api.fetchLatestArticles(12), }) if (isLoading) { return (
{Array.from({ length: 12 }).map((_, i) => (
))}
) } if (error) { return (
ГРЕШКА

Обидете се повторно

) } const articles = data?.data || [] if (articles.length === 0) { return (
НЕМА СТАТИИ

Проверете подоцна

) } return (

Најнови

Сите
{articles.map((article, index) => (
{article.featuredImage ? (
{article.title}
) : (
N
)}

{article.title}

{article.excerpt && (

{article.excerpt}

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