jaecoo-kelapagading/components/landing-page/header.tsx

163 lines
6.1 KiB
TypeScript
Raw Normal View History

2025-07-14 07:31:51 +00:00
"use client";
import Image from "next/image";
import {
Carousel,
CarouselContent,
CarouselItem,
CarouselNext,
CarouselPrevious,
} from "@/components/ui/carousel";
import { Button } from "@/components/ui/button";
import { motion } from "framer-motion";
import Link from "next/link";
2025-07-14 11:55:57 +00:00
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "../ui/dialog";
import { Input } from "../ui/input";
import { Textarea } from "../ui/textarea";
import { useState } from "react";
import Autoplay from "embla-carousel-autoplay"; // ✅ Import plugin autoplay
import { useRef } from "react";
2025-07-14 07:31:51 +00:00
2025-07-14 11:55:57 +00:00
const heroImages = [
"/Hero.png",
2025-08-06 07:11:25 +00:00
// "/Carousell-01.png",
2025-07-14 11:55:57 +00:00
"/Carousell-02.png",
"/Carousell-03.png",
"/Carousell-04.png",
"/Carousell-05.png",
];
2025-07-14 07:31:51 +00:00
export default function Header() {
2025-07-14 11:55:57 +00:00
const [open, setOpen] = useState(false);
// ✅ Gunakan useRef untuk plugin autoplay
const plugin = useRef(Autoplay({ delay: 4000, stopOnInteraction: false }));
2025-07-14 07:31:51 +00:00
return (
<section className="relative w-full overflow-hidden bg-white">
2025-07-14 11:55:57 +00:00
<Carousel
className="w-full relative"
plugins={[plugin.current]} // ✅ Tambahkan plugin di sini
>
2025-07-14 07:31:51 +00:00
<CarouselContent>
{heroImages.map((img, index) => (
<CarouselItem key={index}>
2025-07-14 11:55:57 +00:00
<div className="relative w-full h-[400px] sm:h-[500px] md:h-[810px]">
2025-07-14 07:31:51 +00:00
<Image
src={img}
alt={`JAECOO Image ${index + 1}`}
width={1400}
height={810}
className="object-cover w-full h-full"
/>
{index === 0 && (
2025-07-14 11:55:57 +00:00
<div className="absolute inset-0 flex flex-col justify-center items-start px-4 sm:px-8 md:px-28 z-10">
2025-07-14 07:31:51 +00:00
<motion.h1
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.8, ease: "easeOut" }}
2025-07-14 11:55:57 +00:00
className="text-2xl sm:text-3xl md:text-5xl font-bold text-black mb-4"
2025-07-14 07:31:51 +00:00
>
JAECOO J7 AWD
</motion.h1>
<motion.p
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
transition={{
duration: 0.9,
ease: "easeOut",
delay: 0.2,
}}
2025-07-14 11:55:57 +00:00
className="text-sm sm:text-base md:text-lg text-black mb-6"
2025-07-14 07:31:51 +00:00
>
DELICATE OFF-ROAD SUV
</motion.p>
<motion.div
2025-07-14 11:55:57 +00:00
className="flex flex-col sm:flex-row items-start sm:items-center gap-3 sm:gap-4"
2025-07-14 07:31:51 +00:00
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 1, ease: "easeOut", delay: 0.4 }}
>
2025-07-14 11:55:57 +00:00
<motion.div
className="flex items-center gap-4"
initial={{ opacity: 0, y: 40 }}
animate={{ opacity: 1, y: 0 }}
transition={{
duration: 1,
ease: "easeOut",
delay: 0.4,
}}
>
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button className="bg-[#1F6779] text-white h-[30px] md:h-[40px] rounded-full hover:cursor-pointer">
TEST DRIVE
</Button>
</DialogTrigger>
<DialogContent className="sm:max-w-[1400px] h-[600px]">
<div className="flex items-center gap-4">
<Image
src="/masjaecoonav.png"
alt="MAS JAECOO Logo"
width={300}
height={30}
className=" object-fill"
/>
</div>
<DialogHeader>
<DialogTitle className="text-2xl text-center mb-4">
FORM TEST DRIVE
</DialogTitle>
</DialogHeader>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 px-10">
<Input placeholder="Nama" />
<Input placeholder="Email" />
<Input placeholder="Mobile Number" />
<Input placeholder="Location" />
</div>
<div className="mt-3 px-10">
<Textarea placeholder="Full Message" rows={4} />
</div>
<div className="mt-6 text-left ml-10">
<Button
onClick={() => setOpen(false)}
className="bg-[#1F6779] text-white rounded-full"
>
SEND INQUIRY
</Button>
</div>
</DialogContent>
</Dialog>
<Link href={"/product"}>
<Button
variant="outline"
className="rounded-full border-black text-black px-6 py-2 hover:cursor-pointer hover:bg-amber-50"
>
EXPLORE
</Button>
</Link>
</motion.div>
2025-07-14 07:31:51 +00:00
</motion.div>
</div>
)}
</div>
</CarouselItem>
))}
</CarouselContent>
</Carousel>
</section>
);
}