Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf73b46800 | |||
| 78c98816bb | |||
| b9fae9dc4b | |||
| 338c2ffeff | |||
| aed064ca08 | |||
| 9f9b653fd6 |
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useRef } from "react";
|
||||
import TextBox from "@/components/Textbox";
|
||||
import MediaContent from "@/components/shared/MediaContent";
|
||||
import AutoCarousel from "@/components/cardStack/layouts/carousels/AutoCarousel";
|
||||
@@ -44,6 +45,8 @@ interface HeroBillboardCarouselProps {
|
||||
buttons?: ButtonConfig[];
|
||||
buttonAnimation?: ButtonAnimationType;
|
||||
mediaItems: MediaItem[];
|
||||
backgroundImageSrc?: string;
|
||||
backgroundImageOpacity?: number;
|
||||
ariaLabel?: string;
|
||||
className?: string;
|
||||
containerClassName?: string;
|
||||
@@ -67,6 +70,8 @@ const HeroBillboardCarousel = ({
|
||||
buttons,
|
||||
buttonAnimation,
|
||||
mediaItems,
|
||||
backgroundImageSrc,
|
||||
backgroundImageOpacity = 0.3,
|
||||
ariaLabel = "Hero section",
|
||||
className = "",
|
||||
containerClassName = "",
|
||||
@@ -79,6 +84,8 @@ const HeroBillboardCarousel = ({
|
||||
buttonTextClassName = "",
|
||||
mediaWrapperClassName = "",
|
||||
}: HeroBillboardCarouselProps) => {
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const carouselRef = useRef<HTMLDivElement>(null);
|
||||
const renderCarouselItem = (item: MediaItem, index: number) => (
|
||||
<div
|
||||
key={index}
|
||||
@@ -98,11 +105,24 @@ const HeroBillboardCarousel = ({
|
||||
<section
|
||||
aria-label={ariaLabel}
|
||||
className={cls(
|
||||
"relative w-full py-hero-page-padding md:h-svh md:py-0",
|
||||
"relative w-full py-hero-page-padding md:h-svh md:py-0 overflow-hidden",
|
||||
className
|
||||
)}
|
||||
>
|
||||
<HeroBackgrounds {...background} />
|
||||
{backgroundImageSrc && (
|
||||
<div
|
||||
className="absolute inset-0 z-0"
|
||||
style={{
|
||||
backgroundImage: `url('${backgroundImageSrc}')`,
|
||||
backgroundSize: 'cover',
|
||||
backgroundPosition: 'center',
|
||||
opacity: backgroundImageOpacity,
|
||||
filter: 'blur(40px)',
|
||||
}}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
<div className={cls(
|
||||
"mx-auto flex flex-col gap-14 md:gap-10 relative z-10",
|
||||
"w-full md:w-content-width md:h-full md:items-center md:justify-center",
|
||||
@@ -129,7 +149,12 @@ const HeroBillboardCarousel = ({
|
||||
center={true}
|
||||
/>
|
||||
|
||||
<div className={cls("w-full -mx-[var(--content-padding)]", mediaWrapperClassName)}>
|
||||
<div
|
||||
ref={carouselRef}
|
||||
className={cls("w-full -mx-[var(--content-padding)] relative z-20", mediaWrapperClassName)}
|
||||
onMouseEnter={() => setIsHovered(true)}
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
>
|
||||
<AutoCarousel
|
||||
title=""
|
||||
description=""
|
||||
@@ -141,6 +166,8 @@ const HeroBillboardCarousel = ({
|
||||
itemClassName="!w-55 md:!w-carousel-item-4"
|
||||
ariaLabel="Hero carousel"
|
||||
showTextBox={false}
|
||||
autoPlayInterval={isHovered ? 0 : 5000}
|
||||
pauseOnHover={true}
|
||||
>
|
||||
{mediaItems?.map(renderCarouselItem)}
|
||||
</AutoCarousel>
|
||||
|
||||
Reference in New Issue
Block a user