mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 06:09:45 +00:00
перенес структуру Севы со своими правками
This commit is contained in:
1 parent
3a1cac0dfe
commit
808d97eb4b
331 files changed
+12260
-19950
No files matched your search
@@ -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>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user