hotfix-onecard-swiper

This commit is contained in:
Untone 2024-05-07 00:51:07 +03:00
parent 75c415aece
commit 52ef17dc6d
2 changed files with 35 additions and 3 deletions

View File

@ -28,12 +28,32 @@ export const ArticleCardSwiper = (props: Props) => {
return ( return (
<ShowOnlyOnClient> <ShowOnlyOnClient>
<div class={clsx(styles.Swiper, styles.articleMode, styles.ArticleCardSwiper)}> <div
class={clsx({
[styles.Swiper]: props.slides.length > 1,
[styles.articleMode]: true,
[styles.ArticleCardSwiper]: props.slides.length > 1,
[styles.unswiped]: props.slides.length === 1,
})}
>
<Show when={props.title}> <Show when={props.title}>
<h2 class={styles.sliderTitle}>{props.title}</h2> <h2 class={styles.sliderTitle}>{props.title}</h2>
</Show> </Show>
<div class={styles.container}> <div class={styles.container}>
<Show when={props.slides.length > 0}> <Show
when={props.slides.length > 1}
fallback={
<ArticleCard
article={props.slides[0]}
settings={{
isFloorImportant: true,
isWithCover: true,
nodate: true,
}}
desktopCoverSize="L"
/>
}
>
<div class={styles.holder}> <div class={styles.holder}>
<swiper-container <swiper-container
ref={(el) => (mainSwipeRef.current = el)} ref={(el) => (mainSwipeRef.current = el)}

View File

@ -8,6 +8,18 @@
} }
} }
.unswiped {
width: 100%;
margin: 2rem 0;
margin-bottom: 6rem;
padding-bottom: 2rem;
display: block;
h2 {
text-align: center;
}
}
.Swiper { .Swiper {
display: block; display: block;
margin: 2rem 0; margin: 2rem 0;