import React from 'react'; import { CurrentView, Post } from '../types'; // Added Post type import { SECTION_IDS, BLOG_SECTION_CONTENT } from '../constants'; import { ChevronRightIcon } from './icons'; import PostCard from './PostCard'; interface BlogSectionProps { posts: Post[]; // Changed from mockPosts to accept fetched data setCurrentView: (view: CurrentView) => void; setSelectedItemId: (id: string | null) => void; } const BlogSection: React.FC = ({ posts, setCurrentView, setSelectedItemId }) => { const featuredPost = posts.find(p => p.isFeatured); const otherPosts = posts.filter(p => !p.isFeatured); const handleShowAllClick = (e: React.MouseEvent) => { e.preventDefault(); setCurrentView('storiesAll'); setSelectedItemId(null); }; // App.tsx handles the main loading and error states. // This component now assumes that if `posts` is empty, it's an empty data state, not a loading state. if (posts.length === 0) { return (

{BLOG_SECTION_CONTENT.title}

{BLOG_SECTION_CONTENT.showAllText}

Проектов пока нет.

Возможно, они еще не опубликованы. Пожалуйста, проверьте позже.

); } return (

{BLOG_SECTION_CONTENT.title}

{BLOG_SECTION_CONTENT.showAllText}
{featuredPost && (
)}
{otherPosts.slice(featuredPost ? -3 : -4).reverse().map(post => ( ))}
); }; export default BlogSection;