перенес структуру Севы со своими правками

This commit is contained in:
ifraimka1 committed 2025-04-01 15:25:46 +03:00
1 parent 3a1cac0dfe
commit 808d97eb4b
331 files changed
+12260 -19950

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { usePosts } from "@/modules/posts/hooks/usePosts";
import { PagePost } from "@/widgets/PostPage";
interface CategoryPageProps {
category: string;
}
export function CategoryPage({ category }: CategoryPageProps) {
const { data: postsData, isLoading, isError } = usePosts();
const categoryPosts =
postsData?.other.filter((post) => post.categories.includes(category)) || [];
if (isLoading)
return (
<div className="mainContainer">
<span className="loader"></span>
</div>
);
if (isError) return <div>Ошибка при загрузке данных</div>;
return (
<>
{categoryPosts.map((post) => (
<PagePost key={post.id} post={post}>
<div className="btn">Показать еще</div>
</PagePost>
))}
</>
);
}