diff --git a/src/pages/CardListPages/CardList.module.scss b/src/pages/CardListPages/CardList.module.scss
deleted file mode 100644
index 778cba5..0000000
--- a/src/pages/CardListPages/CardList.module.scss
+++ /dev/null
@@ -1,17 +0,0 @@
-.mainContainer {
- margin: 0 10%;
- @include mediaMax($mobile-xs-width) {
- margin: 0 5%;
- }
-}
-.title {
- font-size: 36px;
- font-weight: 600;
- line-height: 44px;
- margin-top: 0;
- margin-bottom: 8px;
- @include mediaMax($tablet-max-width) {
- font-size: 24px;
- margin-top: 0;
- }
-}
diff --git a/src/pages/CardListPages/CardListPages.tsx b/src/pages/CardListPages/CardListPages.tsx
deleted file mode 100644
index 3c3d944..0000000
--- a/src/pages/CardListPages/CardListPages.tsx
+++ /dev/null
@@ -1,107 +0,0 @@
-// pages/MainPage/ui/MainPage/Lists.tsx
-import { CardList } from "@/widgets/CardList/CardList";
-import { GridConfig } from "@/widgets/CardList/types";
-import { usePosts } from "@/modules/posts/hooks/usePosts";
-import styles from "./CardList.module.scss";
-import { useNews } from "@/modules";
-import {
- transformNewsToCardData,
- transformPostsToCardData,
-} from "@/pages/CardListPages/CardListFunctions";
-import { useProjects } from "@/modules/posts/hooks/usePostProjects";
-
-interface ListProps {
- gridConfig?: GridConfig;
- tag?: number;
-}
-
-const NewsList = ({
- gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
-}: ListProps) => {
- const { data: newsData, isLoading, isError } = useNews();
-
- if (isLoading)
- return (
-
-
{title}
-
- {itemsArray.map((item) => (
-
- ))}
-
+
+ {newsData && (
+
+ )}
);
};
+
+const LabsList = ({
+ gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
+}: ListProps) => {
+ const { data: postsData, isLoading, isError } = usePosts();
+ const labs = postsData?.labs ? Object.values(postsData.labs) : [];
+
+ if (isLoading)
+ return (
+
+
Лаборатории
+
+
+ );
+
+ if (isError) return
Ошибка при загрузке данных
;
+
+ return (
+
+
+
+ );
+};
+
+const ProjectsList = ({
+ gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
+ tag = -1,
+}: ListProps) => {
+ const { data, isError, isLoading } = usePostProjects(tag);
+ const projects = data ?? [];
+
+ if (isLoading)
+ return (
+
+
Проекты
+
+
+ );
+
+ if (isError) return
Ошибка при загрузке данных
;
+
+ return (
+
+
+
+ );
+};
+
+export { NewsList, LabsList, ProjectsList };
diff --git a/src/pages/CardListPages/CardListFunctions.ts b/src/widgets/CardList/CardListFunctions.ts
similarity index 93%
rename from src/pages/CardListPages/CardListFunctions.ts
rename to src/widgets/CardList/CardListFunctions.ts
index a3be870..989c739 100644
--- a/src/pages/CardListPages/CardListFunctions.ts
+++ b/src/widgets/CardList/CardListFunctions.ts
@@ -1,4 +1,4 @@
-import { CardData } from "@/widgets/Card/types";
+import { CardData } from "@/shared/Components/Card/types";
import { App, SKBKit } from "@/shared/types/app";
export const transformPostsToCardData = (
posts: App.WpPost[]
diff --git a/src/widgets/CardList/CardListTemplate.module.scss b/src/widgets/CardList/CardListTemplate.module.scss
new file mode 100644
index 0000000..9e7b4b0
--- /dev/null
+++ b/src/widgets/CardList/CardListTemplate.module.scss
@@ -0,0 +1,48 @@
+.title {
+ font-size: 36px;
+ font-weight: 600;
+ line-height: 44px;
+ margin-top: 0;
+ margin-bottom: 8px;
+ @include mediaMax($tablet-max-width) {
+ font-size: 24px;
+ margin-top: 0;
+ }
+}
+.list {
+ display: grid;
+ gap: 2rem;
+ width: 100%;
+ max-width: 100%;
+ box-sizing: border-box;
+ margin-bottom: 32px;
+ &__lab {
+ grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
+ @include mediaMax($desktop-small-width) {
+ grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
+ }
+ @include mediaMax($tablet-max-width) {
+ grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
+ }
+ }
+
+ &__news {
+ grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
+ @include mediaMax($desktop-small-width) {
+ grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
+ }
+ @include mediaMax($tablet-max-width) {
+ grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
+ }
+ }
+
+ &__project {
+ grid-template-columns: repeat(var(--desktop-columns, 3), 1fr);
+ @include mediaMax($desktop-small-width) {
+ grid-template-columns: repeat(var(--tablet-columns, 3), 1fr);
+ }
+ @include mediaMax($tablet-max-width) {
+ grid-template-columns: repeat(var(--mobile-columns, 3), 1fr);
+ }
+ }
+}
diff --git a/src/widgets/CardList/CardListTemplate.tsx b/src/widgets/CardList/CardListTemplate.tsx
new file mode 100644
index 0000000..034892d
--- /dev/null
+++ b/src/widgets/CardList/CardListTemplate.tsx
@@ -0,0 +1,38 @@
+// widgets/CardList/CardList.tsx
+import { CardListProps } from "@/widgets/CardList/types";
+import styles from "./CardListTemplate.module.scss";
+import { Card } from "@/shared/Components/Card/Card";
+import { classNames } from "@/shared/lib/classNames/classNames";
+
+export const CardListTemplate = ({
+ items,
+ variant = "lab", // Значение по умолчанию
+ gridConfig = { desktop: 3, tablet: 2, mobile: 1 },
+ title = "Лаборатории",
+}: CardListProps) => {
+ const itemsArray = Object.values(items);
+
+ return (
+ <>
+ {itemsArray?.length !== 0 &&
+
+
{title}
+
+ {itemsArray.map((item) => (
+
+ ))}
+
+
+ }
+ >
+ );
+};