Merge pull request #30 from ifraimka1/gallery

Gallery
This commit is contained in:
Ifraim Solomonov authored and GitHub committed 2025-03-13 12:47:06 +03:00
commit 209d3993e0
14 files changed
+175 -175

No files matched your search

+20
View File
@@ -28,6 +28,7 @@
"reactpress": "^1.0.0", "reactpress": "^1.0.0",
"sass": "^1.70.0", "sass": "^1.70.0",
"scroll-carousel-react": "^1.0.0", "scroll-carousel-react": "^1.0.0",
"swiper": "^11.2.5",
"use-callback-ref": "^1.3.1", "use-callback-ref": "^1.3.1",
"web-vitals": "^2.1.4", "web-vitals": "^2.1.4",
"wpapi": "^1.2.2" "wpapi": "^1.2.2"
@@ -17211,6 +17212,25 @@
"boolbase": "~1.0.0" "boolbase": "~1.0.0"
} }
}, },
"node_modules/swiper": {
"version": "11.2.5",
"resolved": "https://registry.npmjs.org/swiper/-/swiper-11.2.5.tgz",
"integrity": "sha512-nG0kbIyBfeE2BPFt9nPUX03qUBF75o6+enzjIT/DfCmbh8ORlwhc4eZz1+4H/yseAgb3H+OoEYzmb64i0tYNnQ==",
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/swiperjs"
},
{
"type": "open_collective",
"url": "http://opencollective.com/swiper"
}
],
"license": "MIT",
"engines": {
"node": ">= 4.7.0"
}
},
"node_modules/symbol-tree": { "node_modules/symbol-tree": {
"version": "3.2.4", "version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
+1
View File
@@ -23,6 +23,7 @@
"reactpress": "^1.0.0", "reactpress": "^1.0.0",
"sass": "^1.70.0", "sass": "^1.70.0",
"scroll-carousel-react": "^1.0.0", "scroll-carousel-react": "^1.0.0",
"swiper": "^11.2.5",
"use-callback-ref": "^1.3.1", "use-callback-ref": "^1.3.1",
"web-vitals": "^2.1.4", "web-vitals": "^2.1.4",
"wpapi": "^1.2.2" "wpapi": "^1.2.2"
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB

+2
View File
@@ -1,4 +1,6 @@
export { default as car } from './car.jpeg'; export { default as car } from './car.jpeg';
export { default as art } from './art.bmp';
export { default as newsMock } from './newsMock.png'; export { default as newsMock } from './newsMock.png';
export { default as labMock } from './labMock.jpeg'; export { default as labMock } from './labMock.jpeg';
+11 -3
View File
@@ -24,9 +24,17 @@ const mockLinks = {
}; };
const mockContacts = { const mockContacts = {
email: "skb@sfedu.ru", email: (
address: "г. Таганрог, пер. Тургеневский, 44", <a style={{ color: 'inherit' }} href="mailto:skb@sfedu.ru">skb@sfedu.ru</a>
phone: "+7 (911) 8888-88-88", ),
address: (
<a style={{ color: 'inherit' }} href="https://yandex.ru/maps/?text=г.%20Таганрог,%20пер.%20Тургеневский,%2044" target="_blank" rel="noopener noreferrer">
г. Таганрог, пер. Тургеневский, 44
</a>
),
phone: (
<a style={{ color: 'inherit' }} href="tel:+79118888888">+7 (911) 8888-88-88</a>
),
}; };
function Footer({ links = mockLinks, contacts = mockContacts }) { function Footer({ links = mockLinks, contacts = mockContacts }) {
+34 -11
View File
@@ -3,7 +3,8 @@
.row.lab-list { .row.lab-list {
display: grid; display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr)); /* Используем 1fr для равных колонок */ grid-template-columns: repeat(3, minmax(0, 1fr));
/* Используем 1fr для равных колонок */
justify-content: space-between; justify-content: space-between;
gap: $row-gap; gap: $row-gap;
max-width: 100%; // Гарантия, что не выйдет за границы max-width: 100%; // Гарантия, что не выйдет за границы
@@ -30,23 +31,31 @@
height: 100%; height: 100%;
opacity: 1; opacity: 1;
transition: opacity 0.3s ease-out; transition: opacity 0.3s ease-out;
pointer-events: none;
} }
.card-content { .card-content {
overflow: hidden; /* Чтобы контент не выходил за границы и карточка не мигала*/ overflow: hidden;
/* Чтобы контент не выходил за границы и карточка не мигала*/
margin: 0; margin: 0;
position: absolute; position: absolute;
inset: auto 20px 10px 20px; inset: auto 20px 10px 20px;
transition: inset .3s; transition: inset .3s;
background: none !important; background: none !important;
z-index: 2; /* Контент всегда сверху */ z-index: 2;
/* Контент всегда сверху */
h2 { h2 {
margin: 0; margin: 0 0 12px 9px;
font-size: 20px; font-size: clamp(10px, 1.5vw, 20px);
font-weight: 600; font-weight: 600;
line-height: clamp(12px, 2vw, 24px);
@media (max-width: 768px) {
font-size: 20px;
line-height: 28px; line-height: 28px;
} }
}
.hidden { .hidden {
max-height: 0; max-height: 0;
@@ -55,16 +64,27 @@
max-width: 80%; max-width: 80%;
p { p {
font-size: 16px; margin: 0 0 10px 9px;
font-size: clamp(8px, 1.5vw, 16px);
font-weight: 400; font-weight: 400;
line-height: clamp(16px, 2vw, 20px);
@media (max-width: 768px) {
font-size: 16px;
line-height: 20px; line-height: 20px;
} }
}
.link-label { .link-label {
font-size: 20px; font-size: clamp(10px, 1.5vw, 20px);
font-weight: 500; font-weight: 500;
line-height: 24px; line-height: clamp(18px, 2vw, 24px);
margin: 0 0 0 9px;
@media (max-width: 768px) {
font-size: 20px;
line-height: 24px;
}
} }
} }
} }
@@ -81,7 +101,8 @@
&:hover .image { &:hover .image {
transition: opacity .3s ease-in; transition: opacity .3s ease-in;
filter: brightness(0.5); /* Затемняем изображение */ filter: brightness(0.5);
/* Затемняем изображение */
} }
} }
} }
@@ -94,7 +115,9 @@
} }
.card { .card {
width: 100%; /* Карточка занимает всю ширину своей колонки */ width: 100%;
height: 215px !important; /* Устанавливаем минимальную высоту */ /* Карточка занимает всю ширину своей колонки */
height: 215px !important;
/* Устанавливаем минимальную высоту */
} }
} }
+18 -8
View File
@@ -33,11 +33,14 @@ $news-card-gap: 1em;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 40%; /* Градиент покрывает 40% карточки */ height: 40%;
/* Градиент покрывает 40% карточки */
background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0)); background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
border-radius: 8px; border-radius: 8px;
pointer-events: none; /* Не мешает взаимодействию */ pointer-events: none;
z-index: 0; /* Градиент уходит в фон */ /* Не мешает взаимодействию */
z-index: 0;
/* Градиент уходит в фон */
} }
.image { .image {
@@ -46,23 +49,30 @@ $news-card-gap: 1em;
object-fit: cover; object-fit: cover;
object-position: top; // Устанавливаем позицию обрезки сверху object-position: top; // Устанавливаем позицию обрезки сверху
border-radius: 8px; // Округление углов изображения border-radius: 8px; // Округление углов изображения
pointer-events: none;
} }
.label { .label {
position: absolute; position: absolute;
width: 100%; width: 100%;
min-height:15%; min-height: 15%;
padding: 22px 16px; padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
left: 0; left: 0;
bottom: 0; bottom: 0;
border-radius: 0 0 8px 8px; border-radius: 0 0 8px 8px;
font-size: 20px; font-size: clamp(10px, 1.5vw, 20px);
font-weight: 600; font-weight: 600;
line-height: 24px; line-height: clamp(12px, 2vw, 24px);
color: white; color: white;
//background: rgba(0, 0, 0, 0.6); //background: rgba(0, 0, 0, 0.6);
//background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%); //background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
@media (max-width: 768px) {
padding: 22px 16px;
font-size: 20px;
line-height: 24px;
}
} }
} }
} }
@@ -19,20 +19,26 @@
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
border-radius: 8px; border-radius: 8px;
pointer-events: none;
} }
.label { .label {
position: absolute; position: absolute;
left: 22px; left: 11px;
bottom: 16px; bottom: 0px;
border-radius: 8px;
padding: 2px; padding: clamp(12px, 3vw, 22px) clamp(6px, 1.5vw, 16px);
border-radius: 4px;
font-size: 20px;
font-weight: 600;
line-height: 28px; line-height: 28px;
color: $text-card-project; color: $text-card-project;
font-size: clamp(12px, 1.8vw, 20px);
font-weight: 600;
line-height: clamp(14px, 2vw, 24px);
@media (max-width: 768px) {
padding: 22px 16px;
font-size: 20px;
line-height: 24px;
}
} }
} }
} }
+26 -58
View File
@@ -1,17 +1,16 @@
import { useEffect, useState, createContext } from 'react'; import { useEffect, useState } from 'react';
import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination } from 'swiper/modules';
import Arrows from './components/Arrows'; import 'swiper/css';
import SlidesList from './components/SlidesList'; import 'swiper/css/navigation';
// import Dots from './components/Dots'; import 'swiper/css/pagination';
import { getMedia } from '../../api'; import { getMedia } from '../../api';
import './Slider.styles.scss'; import './Slider.styles.scss';
export const SliderContext = createContext(); function Slider({ autoPlay = false, autoPlayTime = 3000, images = false }) {
function Slider({ autoPlay = 0, autoPlayTime = 0, images = false }) {
const [mediaList, setMediaList] = useState([]); const [mediaList, setMediaList] = useState([]);
const [slide, setSlide] = useState(0);
const [itemsPerSlide, setItemsPerSlide] = useState(window.innerWidth <= 768 ? 1 : 2); const [itemsPerSlide, setItemsPerSlide] = useState(window.innerWidth <= 768 ? 1 : 2);
useEffect(() => { useEffect(() => {
@@ -24,67 +23,36 @@ function Slider({ autoPlay = 0, autoPlayTime = 0, images = false }) {
useEffect(() => { useEffect(() => {
const loadData = async () => { const loadData = async () => {
let newMediaList; const newMediaList = images
? images.map((value, key) => ({ id: key, src: value }))
if (images) { : await getMedia('gallery');
newMediaList = images.map((value, key) => {
return { id: key, src: value };
});
} else {
newMediaList = await getMedia('gallery');
}
setMediaList(newMediaList); setMediaList(newMediaList);
console.log('sliderMedia', newMediaList);
}; };
console.log(images);
loadData(); loadData();
}, [images]); }, [images]);
const changeSlide = (direction) => {
if (mediaList.length <= itemsPerSlide) return;
let slideNumber = slide + direction;
if (direction === -1 && slideNumber < 0) return;
if (direction === 1 && slideNumber + itemsPerSlide > mediaList.length) return;
setSlide(slideNumber);
};
const goToSlide = (number) => {
if (number >= 0 && number + itemsPerSlide <= mediaList.length) {
setSlide(number);
}
}
useEffect(() => {
if (!autoPlay || mediaList.length <= itemsPerSlide) return;
const interval = setInterval(() => {
changeSlide(1);
}, autoPlayTime);
return () => clearInterval(interval);
}, [mediaList.length, slide, itemsPerSlide]);
return ( return (
<div className="slider"> <div className="slider">
<SliderContext.Provider <Swiper
value={{ modules={[Navigation, Pagination]}
goToSlide, spaceBetween={20}
changeSlide, slidesPerView={itemsPerSlide} // Количество картинок в видимой зоне
slidesCount: mediaList.length, slidesPerGroup={1} // Перелистывать сразу по 2
slideNumber: slide, loop={true} // Зацикленный слайдер
mediaList navigation // Стрелки
}} pagination={{ clickable: true }}
autoplay={autoPlay ? { delay: autoPlayTime, disableOnInteraction: false } : false}
> >
{ mediaList.length > itemsPerSlide && <Arrows /> } {mediaList.map((media) => (
<SlidesList /> <SwiperSlide key={media.id}>
{/* <Dots /> */} <img src={media.src} alt="slide" className="slide-image" />
</SliderContext.Provider> </SwiperSlide>
))}
</Swiper>
</div> </div>
); );
} }
export default Slider; export default Slider;
+43 -43
View File
@@ -1,57 +1,57 @@
.slider { .slider {
overflow: hidden;
position: relative;
& .slide-list {
display: flex;
align-items: center;
justify-content: center; /* Центрируем изображения */
gap: 32px; /* Отступ между картинками */
width: max-content;
width: 100%; width: 100%;
height: 100%;
transition: transform 0.5s ease-in-out;
margin: 0 auto; margin: 0 auto;
padding: 10px 100px; /* Добавляем отступы по бокам */
& .slide {
flex: 1 0 50%;
max-width: 50%; /* Ограничение ширины */
position: relative; position: relative;
display: flex; }
justify-content: center; /* Центрируем контент */
& .slide-image { .swiper-slide {
display: flex; display: flex;
max-height: 60vh; justify-content: center;
max-width: 100%; align-items: center;
height: 50vh;
}
.slide-image {
width: 100%;
height: auto;
height: 350px;
object-fit: cover;
object-position: center center;
border-radius: 8px; border-radius: 8px;
} pointer-events: none;
} }
/* стрелки */
.swiper-button-prev,
.swiper-button-next {
width: 60px;
height: 60px;
background-color: white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
cursor: pointer;
&::after {
font-size: 18px;
font-weight: 1000;
color: black;
} }
} }
/* Медиа-запрос для мобильных устройств */ /* Позиционирование стрелок */
@media (max-width: 768px) { .swiper-button-prev {
.slider { left: 5px;
& .slide-list { @media (max-width: 768px) {
justify-content: left; left: 0px;
gap: 0; /* Убираем лишние отступы */
padding: 0; /* Уменьшаем отступы */
} }
}
& .slide-list .slide { .swiper-button-next {
flex: 1 0 100%; /* Одна картинка в ряд */ right: 5px;
max-width: 100%; /* Использует всю ширину */ @media (max-width: 768px) {
display: flex; right: 0px;
justify-content: center; /* Центрируем */
}
& .slide-list .slide .slide-image {
max-width: 90%; /* Делаем изображение большим, но с небольшими отступами */
height: auto; /* Сохраняем пропорции */
max-height: 70vh; /* Ограничиваем высоту */
border-radius: 8px;
}
} }
} }
+1 -1
View File
@@ -17,7 +17,7 @@ body {
margin: 0; margin: 0;
color: $text-secondary; color: $text-secondary;
background-image: url(/assets/images/car.jpeg); background-image: url(/assets/images/art.bmp);
background-color: $bg-image; background-color: $bg-image;
background-blend-mode: multiply; background-blend-mode: multiply;
background-position: center; background-position: center;
@@ -4,10 +4,10 @@ import './Gallery.styles.scss';
function Gallery() { function Gallery() {
return ( return (
<div id="gallery"><br /> <div id="gallery"><br /><br />
<h1>СКБ «КИТ» - реальные технологические<br /> <h1>СКБ «КИТ» - реальные технологические<br />
проекты под руководством наставников<br /> проекты под руководством наставников<br />
из университета и бизнеса.</h1><br /> из университета и бизнеса.</h1>
<Slider /> <Slider />
</div> </div>
); );
+2 -40
View File
@@ -10,27 +10,12 @@ $news-card-gap: 1em;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
.pic { .pic .label {
//&::before { font-size: clamp(18px, 2vw, 28px);
//content: "";
//position: absolute;
//bottom: 0;
//left: 0;
//width: 100%;
//height: 40%; /* Градиент покрывает 40% карточки */
//background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
//border-radius: 8px;
//pointer-events: none; /* Не мешает взаимодействию */
//z-index: 0; /* Градиент уходит в фон */
//}
.label {
font-size: 28px;
@media (max-width: 768px) { @media (max-width: 768px) {
font-size: 20px; font-size: 20px;
} }
} }
}
} }
@@ -41,18 +26,6 @@ $news-card-gap: 1em;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
/*
.pic {
.image {
height: 70%;
}
.label {
height:30%;
padding: 16px 0px;
color: black;
}
}
*/
} }
/* Для всех остальных строк карточки остаются по 3 штуки в строке */ /* Для всех остальных строк карточки остаются по 3 штуки в строке */
@@ -62,16 +35,5 @@ $news-card-gap: 1em;
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; width: 100%;
} }
/*.pic {
.image {
height: 70%;
}
.label {
height:30%;
padding: 16px 0px;
color: black;
}
}
*/
} }
} }
+1 -1
View File
@@ -61,7 +61,7 @@
} }
.content { .content {
background: $bg-primary; //background: $bg-primary;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }