@@ -28,7 +28,6 @@ import CalendarAdd from "@/components/icons/calendar-add.svg"
28
28
import { TwImage } from "@/components/Image"
29
29
import MainArticle from "@/components/MainArticle"
30
30
import PageMetadata from "@/components/PageMetadata"
31
- import Swiper from "@/components/Swiper"
32
31
import { TranslatathonBanner } from "@/components/Translatathon/TranslatathonBanner"
33
32
import { Button , ButtonLink } from "@/components/ui/buttons/Button"
34
33
import {
@@ -48,6 +47,7 @@ import {
48
47
SectionTag ,
49
48
} from "@/components/ui/section"
50
49
import { SkeletonLines } from "@/components/ui/skeleton"
50
+ import { Swiper , SwiperContainer } from "@/components/ui/swiper"
51
51
import WindowBox from "@/components/WindowBox"
52
52
53
53
import { cn } from "@/lib/utils/cn"
@@ -265,32 +265,34 @@ const HomePage = ({
265
265
</ div >
266
266
267
267
{ /* Mobile */ }
268
- < Swiper
269
- effect = "cards"
270
- containerClassName = { cn (
268
+ < SwiperContainer
269
+ className = { cn (
271
270
"lg:hidden" , // Mobile only
272
271
"[&_.swiper-slide]:overflow-visible [&_.swiper-slide]:rounded-2xl [&_.swiper-slide]:shadow-card-hover" ,
273
272
"[&_.swiper]:mx-auto [&_.swiper]:mt-4 [&_.swiper]:!flex [&_.swiper]:h-fit [&_.swiper]:max-w-128 [&_.swiper]:flex-col [&_.swiper]:items-center"
274
273
) }
275
- onSlideChange = { ( { activeIndex } ) => {
276
- trackCustomEvent ( {
277
- eventCategory : "Homepage" ,
278
- eventAction : "mobile use cases" ,
279
- eventName : `swipe to card ${ activeIndex + 1 } ` ,
280
- } )
281
- } }
282
274
>
283
- { bentoItems . map ( ( { className, ...item } ) => (
284
- < BentoCard
285
- key = { item . title }
286
- imgHeight = { 220 }
287
- { ...item }
288
- className = { cn ( className , "bg-background text-body" ) }
289
- imgWidth = { undefined } // Intentionally last to override box
290
- />
291
- ) ) }
292
- </ Swiper >
293
-
275
+ < Swiper
276
+ effect = "cards"
277
+ onSlideChange = { ( { activeIndex } ) => {
278
+ trackCustomEvent ( {
279
+ eventCategory : "Homepage" ,
280
+ eventAction : "mobile use cases" ,
281
+ eventName : `swipe to card ${ activeIndex + 1 } ` ,
282
+ } )
283
+ } }
284
+ >
285
+ { bentoItems . map ( ( { className, ...item } ) => (
286
+ < BentoCard
287
+ key = { item . title }
288
+ imgHeight = { 220 }
289
+ { ...item }
290
+ className = { cn ( className , "bg-background text-body" ) }
291
+ imgWidth = { undefined } // Intentionally last to override box
292
+ />
293
+ ) ) }
294
+ </ Swiper >
295
+ </ SwiperContainer >
294
296
{ /* Desktop */ }
295
297
{ bentoItems . map ( ( { className, ...item } ) => (
296
298
< BentoCard
@@ -658,50 +660,51 @@ const HomePage = ({
658
660
</ h3 >
659
661
< p > { t ( "page-index:page-index-posts-subtitle" ) } </ p >
660
662
661
- < Swiper
662
- containerClassName = "mt-4 md:mt-16"
663
- spaceBetween = { 32 }
664
- breakpoints = { {
665
- [ breakpointAsNumber . sm ] : {
666
- slidesPerView : 2 ,
667
- slidesPerGroup : 2 ,
668
- } ,
669
- [ breakpointAsNumber . lg ] : {
670
- slidesPerView : 3 ,
671
- slidesPerGroup : 3 ,
672
- } ,
673
- } }
674
- >
675
- { rssItems . map ( ( { pubDate, title, source, link, imgSrc } ) => (
676
- < Card
677
- key = { title }
678
- href = { link }
679
- customEventOptions = { {
680
- eventCategory : "Homepage" ,
681
- eventAction : "blogs_posts" ,
682
- eventName : source ,
683
- } }
684
- >
685
- < CardBanner >
686
- { /* eslint-disable-next-line @next/next/no-img-element */ }
687
- < img src = { imgSrc } alt = "" loading = "lazy" />
688
- </ CardBanner >
689
- < CardContent >
690
- < CardTitle > { title } </ CardTitle >
691
- { isValidDate ( pubDate ) && (
692
- < CardSubTitle >
693
- { new Intl . DateTimeFormat ( locale , {
694
- month : "long" ,
695
- day : "numeric" ,
696
- year : "numeric" ,
697
- } ) . format ( new Date ( pubDate ) ) }
698
- </ CardSubTitle >
699
- ) }
700
- < CardHighlight > { source } </ CardHighlight >
701
- </ CardContent >
702
- </ Card >
703
- ) ) }
704
- </ Swiper >
663
+ < SwiperContainer className = "mt-4 md:mt-16" >
664
+ < Swiper
665
+ spaceBetween = { 32 }
666
+ breakpoints = { {
667
+ [ breakpointAsNumber . sm ] : {
668
+ slidesPerView : 2 ,
669
+ slidesPerGroup : 2 ,
670
+ } ,
671
+ [ breakpointAsNumber . lg ] : {
672
+ slidesPerView : 3 ,
673
+ slidesPerGroup : 3 ,
674
+ } ,
675
+ } }
676
+ >
677
+ { rssItems . map ( ( { pubDate, title, source, link, imgSrc } ) => (
678
+ < Card
679
+ key = { title }
680
+ href = { link }
681
+ customEventOptions = { {
682
+ eventCategory : "Homepage" ,
683
+ eventAction : "blogs_posts" ,
684
+ eventName : source ,
685
+ } }
686
+ >
687
+ < CardBanner >
688
+ { /* eslint-disable-next-line @next/next/no-img-element */ }
689
+ < img src = { imgSrc } alt = "" loading = "lazy" />
690
+ </ CardBanner >
691
+ < CardContent >
692
+ < CardTitle > { title } </ CardTitle >
693
+ { isValidDate ( pubDate ) && (
694
+ < CardSubTitle >
695
+ { new Intl . DateTimeFormat ( locale , {
696
+ month : "long" ,
697
+ day : "numeric" ,
698
+ year : "numeric" ,
699
+ } ) . format ( new Date ( pubDate ) ) }
700
+ </ CardSubTitle >
701
+ ) }
702
+ < CardHighlight > { source } </ CardHighlight >
703
+ </ CardContent >
704
+ </ Card >
705
+ ) ) }
706
+ </ Swiper >
707
+ </ SwiperContainer >
705
708
706
709
< div className = "mt-8 flex flex-col gap-4 rounded-2xl border p-8" >
707
710
< p className = "text-lg" > { t ( "page-index:page-index-posts-action" ) } </ p >
0 commit comments