Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6ed15c2cc | |||
| 7ece8f2861 | |||
| 56d41aa516 | |||
| 4f3efdc620 | |||
| bebf2f4c1d | |||
| 5679063b68 |
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
|
||||
import { useState } from "react";
|
||||
import MediaContent from "@/components/shared/MediaContent";
|
||||
import TextBox from "@/components/Textbox";
|
||||
import { cls } from "@/lib/utils";
|
||||
@@ -31,6 +31,11 @@ interface MediaAboutProps {
|
||||
buttonTextClassName?: string;
|
||||
mediaWrapperClassName?: string;
|
||||
mediaClassName?: string;
|
||||
backgroundVideoSrc?: string;
|
||||
backgroundVideoAriaLabel?: string;
|
||||
backSideTitle?: string;
|
||||
backSideDescription?: string;
|
||||
enableFlip?: boolean;
|
||||
}
|
||||
|
||||
const MediaAbout = ({
|
||||
@@ -57,42 +62,110 @@ const MediaAbout = ({
|
||||
buttonTextClassName = "",
|
||||
mediaWrapperClassName = "",
|
||||
mediaClassName = "",
|
||||
backgroundVideoSrc,
|
||||
backgroundVideoAriaLabel,
|
||||
backSideTitle = "Learn More",
|
||||
backSideDescription = "Discover additional details about our story and mission.",
|
||||
enableFlip = false,
|
||||
}: MediaAboutProps) => {
|
||||
const [isFlipped, setIsFlipped] = useState(false);
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-label={ariaLabel}
|
||||
style={backgroundVideoSrc ? { position: "relative" } : undefined}
|
||||
className={cls("relative", backgroundVideoSrc && "overflow-hidden")}
|
||||
className={cls("relative py-20 w-full", useInvertedBackground && "bg-foreground", className)}
|
||||
>
|
||||
<div className={cls("relative w-content-width mx-auto aspect-auto min-h-70 md:aspect-video md:min-h-0 rounded-theme-capped overflow-hidden", mediaWrapperClassName)}>
|
||||
<MediaContent
|
||||
imageSrc={imageSrc}
|
||||
videoSrc={videoSrc}
|
||||
imageAlt={imageAlt}
|
||||
videoAriaLabel={videoAriaLabel}
|
||||
imageClassName={cls("w-full h-full object-cover", mediaClassName)}
|
||||
/>
|
||||
<div className="absolute inset-0 z-0 bg-background/40 backdrop-blur-xs pointer-events-none select-none rounded-theme-capped" />
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<div className="relative z-10 flex items-center justify-center h-full w-content-width p-5 md:w-45 mx-auto">
|
||||
<TextBox
|
||||
title={title}
|
||||
description={description}
|
||||
tag={tag}
|
||||
tagIcon={tagIcon}
|
||||
tagAnimation={tagAnimation}
|
||||
buttons={buttons}
|
||||
buttonAnimation={buttonAnimation}
|
||||
className={cls("flex flex-col gap-3 md:gap-1", textBoxClassName)}
|
||||
titleClassName={cls("text-6xl font-medium text-balance", titleClassName)}
|
||||
descriptionClassName={cls("text-base md:text-lg leading-[1.2]", descriptionClassName)}
|
||||
tagClassName={cls("px-3 py-1 text-sm rounded-theme card text-foreground inline-flex items-center gap-2 mb-3", tagClassName)}
|
||||
buttonContainerClassName={cls("flex flex-wrap gap-4 max-md:justify-center mt-3", buttonContainerClassName)}
|
||||
buttonClassName={buttonClassName}
|
||||
buttonTextClassName={buttonTextClassName}
|
||||
center={true}
|
||||
<div
|
||||
className={cls("relative w-content-width mx-auto aspect-auto min-h-70 md:aspect-video md:min-h-0 rounded-theme-capped overflow-hidden", mediaWrapperClassName)}
|
||||
style={enableFlip ? {
|
||||
perspective: "1000px",
|
||||
cursor: "pointer",
|
||||
} : undefined}
|
||||
onMouseEnter={() => enableFlip && setIsFlipped(true)}
|
||||
onMouseLeave={() => enableFlip && setIsFlipped(false)}
|
||||
>
|
||||
<div
|
||||
style={enableFlip ? {
|
||||
position: "relative",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
transformStyle: "preserve-3d",
|
||||
transform: isFlipped ? "rotateY(180deg)" : "rotateY(0deg)",
|
||||
transition: "transform 0.6s ease-in-out",
|
||||
} : undefined}
|
||||
>
|
||||
{/* Front side */}
|
||||
<div
|
||||
style={enableFlip ? {
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
backfaceVisibility: "hidden",
|
||||
} : undefined}
|
||||
className="group"
|
||||
>
|
||||
<MediaContent
|
||||
imageSrc={imageSrc}
|
||||
videoSrc={videoSrc}
|
||||
imageAlt={imageAlt}
|
||||
videoAriaLabel={videoAriaLabel}
|
||||
imageClassName={cls("w-full h-full object-cover transition-shadow duration-300 group-hover:shadow-inner", mediaClassName)}
|
||||
/>
|
||||
<div className="absolute inset-0 z-0 bg-background/40 backdrop-blur-xs pointer-events-none select-none rounded-theme-capped" />
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<div className="relative z-10 flex items-center justify-center h-full w-content-width p-5 md:w-45 mx-auto">
|
||||
<TextBox
|
||||
title={title}
|
||||
description={description}
|
||||
tag={tag}
|
||||
tagIcon={tagIcon}
|
||||
tagAnimation={tagAnimation}
|
||||
buttons={buttons}
|
||||
buttonAnimation={buttonAnimation}
|
||||
className={cls("flex flex-col gap-3 md:gap-1", textBoxClassName)}
|
||||
titleClassName={cls("text-6xl font-medium text-balance", titleClassName)}
|
||||
descriptionClassName={cls("text-base md:text-lg leading-[1.2]", descriptionClassName)}
|
||||
tagClassName={cls("px-3 py-1 text-sm rounded-theme card text-foreground inline-flex items-center gap-2 mb-3", tagClassName)}
|
||||
buttonContainerClassName={cls("flex flex-wrap gap-4 max-md:justify-center mt-3", buttonContainerClassName)}
|
||||
buttonClassName={buttonClassName}
|
||||
buttonTextClassName={buttonTextClassName}
|
||||
center={true}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Back side */}
|
||||
{enableFlip && (
|
||||
<div
|
||||
style={{
|
||||
position: "absolute",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
backfaceVisibility: "hidden",
|
||||
transform: "rotateY(180deg)",
|
||||
backgroundColor: useInvertedBackground ? "hsl(var(--background))" : "hsl(var(--foreground))",
|
||||
}}
|
||||
className="rounded-theme-capped"
|
||||
>
|
||||
<div className="absolute inset-0 z-0 bg-background/40 backdrop-blur-xs pointer-events-none select-none rounded-theme-capped" />
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
<div className="relative z-10 flex items-center justify-center h-full w-content-width p-5 md:w-45 mx-auto">
|
||||
<TextBox
|
||||
title={backSideTitle}
|
||||
description={backSideDescription}
|
||||
className={cls("flex flex-col gap-3 md:gap-1", textBoxClassName)}
|
||||
titleClassName={cls("text-4xl font-medium text-balance", titleClassName)}
|
||||
descriptionClassName={cls("text-base md:text-lg leading-[1.2]", descriptionClassName)}
|
||||
buttonContainerClassName={cls("flex flex-wrap gap-4 max-md:justify-center mt-3", buttonContainerClassName)}
|
||||
center={true}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user