mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 04:49:45 +00:00
Подгон слайдера под проекты
This commit is contained in:
1 parent
ec6275a4f2
commit
4591a8b77c
4 files changed
+75
-34
No files matched your search
@@ -12,7 +12,7 @@ export const useResizeObserver = ({
|
|||||||
parentSelector,
|
parentSelector,
|
||||||
childSelector = 'blockquote',
|
childSelector = 'blockquote',
|
||||||
onResize = (parent, height) => {
|
onResize = (parent, height) => {
|
||||||
parent.style.marginBottom = `calc(${height}px + 2em)`;
|
parent.style.paddingBottom = `calc(${height}px + 2em)`;
|
||||||
}
|
}
|
||||||
}: UseResizeObserverConfig) => {
|
}: UseResizeObserverConfig) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ interface SliderContextType {
|
|||||||
export const SliderContext = createContext<SliderContextType>({
|
export const SliderContext = createContext<SliderContextType>({
|
||||||
slideNumber: 0,
|
slideNumber: 0,
|
||||||
mediaList: [],
|
mediaList: [],
|
||||||
goToSlide: () => {},
|
goToSlide: () => { },
|
||||||
slidesCount: 0,
|
slidesCount: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,38 +91,40 @@ function Slider({
|
|||||||
return (
|
return (
|
||||||
<SliderContext.Provider value={contextValue}>
|
<SliderContext.Provider value={contextValue}>
|
||||||
<div className="slider">
|
<div className="slider">
|
||||||
<Swiper
|
<div className="full-width-container">
|
||||||
modules={[Navigation, Pagination]}
|
<Swiper
|
||||||
spaceBetween={20}
|
modules={[Navigation, Pagination]}
|
||||||
slidesPerView={itemsPerSlide}
|
spaceBetween={20}
|
||||||
slidesPerGroup={1}
|
slidesPerView={itemsPerSlide}
|
||||||
loop={enableButtons}
|
slidesPerGroup={1}
|
||||||
navigation={enableButtons}
|
loop={enableButtons}
|
||||||
pagination={{ clickable: enableButtons }}
|
navigation={enableButtons}
|
||||||
autoplay={
|
pagination={{ clickable: enableButtons }}
|
||||||
autoPlay
|
autoplay={
|
||||||
? { delay: autoPlayTime, disableOnInteraction: false }
|
autoPlay
|
||||||
: false
|
? { delay: autoPlayTime, disableOnInteraction: false }
|
||||||
}
|
: false
|
||||||
onSlideChange={(swiper) => setSlideNumber(swiper.activeIndex)}
|
}
|
||||||
>
|
onSlideChange={(swiper) => setSlideNumber(swiper.activeIndex)}
|
||||||
{filteredMedia.map((media) => (
|
>
|
||||||
<SwiperSlide
|
{filteredMedia.map((media) => (
|
||||||
key={media.id}
|
<SwiperSlide
|
||||||
className={
|
key={media.id}
|
||||||
filteredMedia.length === 1
|
className={
|
||||||
? "swiper-slide single"
|
filteredMedia.length === 1
|
||||||
: "swiper-slide"
|
? "swiper-slide single"
|
||||||
}
|
: "swiper-slide"
|
||||||
>
|
}
|
||||||
<img
|
>
|
||||||
src={media.src}
|
<img
|
||||||
alt={`slide-${media.id}`}
|
src={media.src}
|
||||||
className="slide-image"
|
alt={`slide-${media.id}`}
|
||||||
/>
|
className="slide-image"
|
||||||
</SwiperSlide>
|
/>
|
||||||
))}
|
</SwiperSlide>
|
||||||
</Swiper>
|
))}
|
||||||
|
</Swiper>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</SliderContext.Provider>
|
</SliderContext.Provider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ $color-usual: #ACACAC;
|
|||||||
$border-raduis: 16px;
|
$border-raduis: 16px;
|
||||||
$background-tape: #F5F5F7;
|
$background-tape: #F5F5F7;
|
||||||
|
|
||||||
|
$swiper-button-size: 48px;
|
||||||
|
$swiper-button-arrow-size: 20px;
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--wp--preset--spacing--10: 5%;
|
--wp--preset--spacing--10: 5%;
|
||||||
--wp--preset--spacing--20: 10%;
|
--wp--preset--spacing--20: 10%;
|
||||||
@@ -50,6 +53,7 @@ $background-tape: #F5F5F7;
|
|||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "Цитаты"
|
||||||
.wp-block-pullquote {
|
.wp-block-pullquote {
|
||||||
* {
|
* {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@@ -72,6 +76,7 @@ $background-tape: #F5F5F7;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Таблица
|
||||||
.table-wrapper {
|
.table-wrapper {
|
||||||
border: 1px solid $table-header-color;
|
border: 1px solid $table-header-color;
|
||||||
border-radius: $border-raduis;
|
border-radius: $border-raduis;
|
||||||
@@ -135,4 +140,37 @@ $background-tape: #F5F5F7;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// .slider {
|
||||||
|
// position: static;
|
||||||
|
|
||||||
|
// .swiper {
|
||||||
|
// height: 476px;
|
||||||
|
|
||||||
|
// .swiper-wrapper {
|
||||||
|
// align-items: flex-end;
|
||||||
|
// position: absolute;
|
||||||
|
// left: 0;
|
||||||
|
// width: 100%;
|
||||||
|
|
||||||
|
// .swiper-slide {
|
||||||
|
// height: 376px;
|
||||||
|
// width: 376px;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .swiper-button-prev, .swiper-button-next {
|
||||||
|
// top: calc($swiper-button-size / 2);
|
||||||
|
// left: auto;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .swiper-button-prev {
|
||||||
|
// right: calc($swiper-button-size);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// .swiper-pagination {
|
||||||
|
// display: none;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ export default function WpPost({
|
|||||||
children,
|
children,
|
||||||
}: WpPostProps) {
|
}: WpPostProps) {
|
||||||
useResizeObserver({parentSelector: '.wp-block-pullquote'});
|
useResizeObserver({parentSelector: '.wp-block-pullquote'});
|
||||||
|
// useResizeObserver({parentSelector: ".swiper", childSelector: ".swiper-wrapper"});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={post.categories?.includes('projects') ? "project" : ""}>
|
<div className={post.categories?.includes('projects') ? "project" : ""}>
|
||||||
|
|||||||
Reference in new issue
Block a user