From 8888f3a9c4d237eb340613a9db399bc68a73e4d9 Mon Sep 17 00:00:00 2001 From: ifraimka Date: Thu, 7 Nov 2024 16:34:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=82=D0=BE=D1=87=D0=B5=D0=BA=20=D0=BB=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B8=D0=B9=20=D0=B8?= =?UTF-8?q?=20=D0=B8=D1=85=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20+=20?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Labs/LabCard.jsx | 18 ++++++ src/components/Labs/LabList.jsx | 67 +++++++++++++++++++++ src/components/Labs/LabList.styles.scss | 80 +++++++++++++++++++++++++ src/components/Labs/index.js | 2 + 4 files changed, 167 insertions(+) create mode 100644 src/components/Labs/LabCard.jsx create mode 100644 src/components/Labs/LabList.jsx create mode 100644 src/components/Labs/LabList.styles.scss create mode 100644 src/components/Labs/index.js diff --git a/src/components/Labs/LabCard.jsx b/src/components/Labs/LabCard.jsx new file mode 100644 index 0000000..7c3a54b --- /dev/null +++ b/src/components/Labs/LabCard.jsx @@ -0,0 +1,18 @@ +import { Link } from 'react-router-dom'; + +function LabCard({ lab }) { + return ( + + +
+

{lab.name}

+
+

{lab.previewText}

+
Перейти →
+
+
+ + ); +} + +export default LabCard; \ No newline at end of file diff --git a/src/components/Labs/LabList.jsx b/src/components/Labs/LabList.jsx new file mode 100644 index 0000000..f51eb31 --- /dev/null +++ b/src/components/Labs/LabList.jsx @@ -0,0 +1,67 @@ +import { useState, useEffect } from 'react'; + +import LabCard from './LabCard'; + +import { getLabs } from '../../api'; + +import { labMock } from '../../assets/images'; +import './LabList.styles.scss'; + +const mock = { + cyber: { + name: "Лаборатория кибернетики", + previewText: "Управление робототехническими системами, создание аппаратных и программных продуктов, а также проектирование программных систем.", + link: "/labs", + preview: labMock, + }, + cv: { + name: "Лаборатория компьютерного зрения", + previewText: "Работа с методами и технологиями сегментации изображений, ИИ и нейронными сетями.", + link: "/labs", + preview: labMock, + }, + st: { + name: "Лаборатория SmartTech", + previewText: "Проектирование систем в концепции “Интернета вещей” и технологии “Умного дома”.", + link: "/labs", + preview: labMock, + }, + vr: { + name: "Лаборатория VR и AR", + previewText: "Разработка приложений для виртуальной и дополненной реальности, 3D-моделирование.", + link: "/labs", + preview: labMock, + }, + mobile: { + name: "Лаборатория мобильной разработки", + previewText: "Разработка приложений для портативных устройств, создание дизайна и проектов мобильных приложений.", + link: "/labs", + preview: labMock, + }, + print: { + name: "Лаборатория 3D-печати и прототипирования", + previewText: "Проектирование 3D-модели, работа с 3D-принтером и создание качественных трёхмерных макетов.", + link: "/labs", + preview: labMock, + }, +}; + +function LabList() { + const [labList, setLabList] = useState(mock); + + useEffect(() => { + const loadData = async () => { + const newLabList = await getLabs(); + setLabList(newLabList); + }; + loadData(); + }, []); + + return ( +
+ {Object.values(labList).map(lab => )} +
+ ); +} + +export default LabList; \ No newline at end of file diff --git a/src/components/Labs/LabList.styles.scss b/src/components/Labs/LabList.styles.scss new file mode 100644 index 0000000..e374478 --- /dev/null +++ b/src/components/Labs/LabList.styles.scss @@ -0,0 +1,80 @@ +@import "../../assets/styles/theme.scss"; + +.row.lab-list { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 26px; + + .card { + flex: 1 1 30%; + height: 300px; + + overflow: hidden; + position: relative; + + border-radius: 8px; + + color: $text-secondary; + background: $bg-card-lab; + + .image { + position: absolute; + object-fit: cover; + width: 100%; + height: 100%; + opacity: 0.9; + transition: opacity .2s ease-out; + } + + .content { + margin: 0; + position: absolute; + inset: auto 20px 10px 20px; + transition: inset .3s; + background: none !important; + + h2 { + margin: 0; + + font-size: 24px; + font-weight: 600; + line-height: 28px; + } + + .hidden { + max-height: 0; + transition: max-height 0.3s ease-out, opacity 0.3s 0.3s ease-out; + opacity: 0; + max-width: 80%; + + p { + font-size: 16px; + font-weight: 400; + line-height: 20px; + } + + .link-label { + font-size: 20px; + font-weight: 500; + line-height: 24px; + } + } + } + + &:hover .content { + bottom: 20px; + } + + &:hover .content .hidden { + max-height: 200px; + opacity: 1; + transition: max-height 0.3s ease-out, opacity .1s ease-in; + } + + &:hover .image { + transition: opacity .3s ease-in; + opacity: 0.5; + } + } +} \ No newline at end of file diff --git a/src/components/Labs/index.js b/src/components/Labs/index.js new file mode 100644 index 0000000..5223cfd --- /dev/null +++ b/src/components/Labs/index.js @@ -0,0 +1,2 @@ +export { default as LabCard } from "./LabCard"; +export { default as LabList } from "./LabList"; \ No newline at end of file