File tree Expand file tree Collapse file tree 3 files changed +37
-17
lines changed
public/about-us/our-story Expand file tree Collapse file tree 3 files changed +37
-17
lines changed Original file line number Diff line number Diff line change 11import { PageHeader } from "@/components/primitives/page-header" ;
2+ import { Hero } from "@/components/sections/hero" ;
23import { buildPageMetadata , siteConfig } from "@/lib/config" ;
34import { Metadata } from "next" ;
45
@@ -31,6 +32,16 @@ export default function OurStory() {
3132 based in HK by 2027.
3233 </ >
3334 }
35+ className = "mb-8"
36+ />
37+ < Hero
38+ slides = { [
39+ {
40+ imageSrc : "/about-us/our-story/white-doves.jpg" ,
41+ content : null ,
42+ } ,
43+ ] }
44+ heightClassName = "h-[15rem] md:h-[20rem]"
3445 />
3546 </ section >
3647 ) ;
Original file line number Diff line number Diff line change @@ -27,40 +27,49 @@ export function Hero({ slides, heightClassName }: HeroProps) {
2727 if ( ! heightClassName ) {
2828 throw new Error ( "Hero: 'heightClassName' is required." ) ;
2929 }
30+ const hasMultipleSlides = slides . length > 1 ;
3031 return (
3132 < div className = "relative w-full" >
3233 < Carousel
3334 className = "w-full"
3435 opts = { {
35- loop : true ,
36+ loop : hasMultipleSlides ,
3637 } }
37- plugins = { [
38- Autoplay ( {
39- delay : 5000 ,
40- stopOnInteraction : true ,
41- } ) ,
42- ] }
43- useDots
38+ plugins = {
39+ hasMultipleSlides
40+ ? [
41+ Autoplay ( {
42+ delay : 5000 ,
43+ stopOnInteraction : true ,
44+ } ) ,
45+ ]
46+ : [ ]
47+ }
48+ useDots = { hasMultipleSlides }
4449 >
4550 < CarouselContent >
4651 { slides . map ( ( slide , index ) => (
4752 < CarouselItem key = { index } >
48- < div className = "p-1" >
49- < div
50- className = { `relative flex ${ heightClassName } items-center justify-center bg-cover bg-center bg-no-repeat p-6` }
51- style = { { backgroundImage : `url(' ${ slide . imageSrc } ')` } }
52- >
53- < div className = "absolute inset-0 bg-black/40" />
53+ < div
54+ className = { `relative flex ${ heightClassName } items-center justify-center bg-cover bg-center bg-no-repeat` }
55+ style = { { backgroundImage : `url(' ${ slide . imageSrc } ')` } }
56+ >
57+ { slide . content ? < div className = "absolute inset-0 bg-black/40" /> : null }
58+ { slide . content ? (
5459 < span className = "relative z-10 text-center text-2xl font-semibold text-white md:text-4xl" >
5560 { slide . content }
5661 </ span >
57- </ div >
62+ ) : null }
5863 </ div >
5964 </ CarouselItem >
6065 ) ) }
6166 </ CarouselContent >
62- < CarouselPrevious />
63- < CarouselNext />
67+ { hasMultipleSlides ? (
68+ < >
69+ < CarouselPrevious />
70+ < CarouselNext />
71+ </ >
72+ ) : null }
6473 </ Carousel >
6574 </ div >
6675 ) ;
You can’t perform that action at this time.
0 commit comments