mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 06:19:45 +00:00
Получение, хранение и отображение проектов; новый компонент ProjectList, перенос к нему ProjectCard; реализация страниц проектов
This commit is contained in:
1 parent
81d2a009e0
commit
0ef02b2220
13 files changed
+132
-115
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import ProjectCard from "./ProjectCard";
|
||||
import { getProjects } from "../../api";
|
||||
|
||||
import "./ProjectList.styles.scss";
|
||||
|
||||
function ProjectList({ laboratory }) {
|
||||
const [projectList, setProjectList] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
const loadData = async () => {
|
||||
const newProjectList = await getProjects(laboratory);
|
||||
setProjectList(newProjectList);
|
||||
};
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="row project-list">
|
||||
{Object.keys(projectList).map(id => <ProjectCard key={id} project={projectList[id]} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProjectList;
|
||||
Reference in new issue
Block a user