2025-09-20 20:45:05 +05:30

214 lines
10 KiB
JavaScript

'use client'
import React, { useState } from 'react';
import Link from "next/link";
import { Autoplay, Navigation, Pagination } from "swiper/modules";
import { Swiper, SwiperSlide } from "swiper/react";
import { motion, AnimatePresence } from "framer-motion";
import "swiper/css";
import "swiper/css/navigation";
import "swiper/css/pagination";
const swiperOptions = {
modules: [Autoplay, Pagination, Navigation],
slidesPerView: 1,
spaceBetween: 0,
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
loop: true,
navigation: {
nextEl: '.h1n',
prevEl: '.h1p',
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
};
const variants = {
topToBottom: {
initial: { y: '-100vh', opacity: 0 },
animate: { y: 0, opacity: 1 },
exit: { y: '100vh', opacity: 0 }
},
bottomToTop: {
initial: { y: '100vh', opacity: 0 },
animate: { y: 0, opacity: 1 },
exit: { y: '-100vh', opacity: 0 }
},
leftToRight: {
initial: { x: '-100vw', opacity: 0 },
animate: { x: 0, opacity: 1 },
exit: { x: '100vw', opacity: 0 }
},
rightToLeft: {
initial: { x: '100vw', opacity: 0 },
animate: { x: 0, opacity: 1 },
exit: { x: '-100vw', opacity: 0 }
},
};
const transition = {
type: "tween",
ease: [0.4, 0.0, 0.2, 1],
duration: 1.2
};
export default function Banner() {
const [activeIndex, setActiveIndex] = useState(0);
const [isAnimating, setIsAnimating] = useState(false);
const handleSlideChange = (swiper) => {
setIsAnimating(true);
setActiveIndex(swiper.realIndex || 0);
setTimeout(() => setIsAnimating(false), 1200);
};
return (
<section className="banner-style-two p_relative">
<Swiper
{...swiperOptions}
className="banner-carousel owl-theme owl-carousel owl-nav-none owl-dots-none"
onSwiper={(swiper) => setActiveIndex(swiper.realIndex || 0)}
onSlideChange={handleSlideChange}
>
{/* Slide 1 */}
<SwiperSlide>
<AnimatePresence mode="wait">
{activeIndex === 0 && (
<motion.div
key="slide-0"
className="slide-item banner-slide"
variants={variants.topToBottom}
initial="initial"
animate="animate"
exit="exit"
transition={transition}
>
<div className="bg-layer bg-slide-0"
style={{ backgroundImage: 'url(/assets/images/banner/desktopBanner/home-banner-1.webp)' }}>
</div>
<div className="auto-container" style={{height:"600px"}}>
{/* <div className="content-box custom-content-box">
<span className="upper-text">Begin Your Health Journey</span>
<h2>Better <span>health</span> Forever</h2>
<p>Our expert physiotherapists help you restore movement, reduce pain, and live healthier with personalized care in Mississauga.</p>
<div className="btn-box mt-3">
<Link href="tel:+647-722-3434" className="theme-btn btn-one">
<span>Book Your Appointment</span>
</Link>
</div>
</div> */}
</div>
</motion.div>
)}
</AnimatePresence>
</SwiperSlide>
{/* Slide 2 */}
<SwiperSlide>
<AnimatePresence mode="wait">
{activeIndex === 1 && (
<motion.div
key="slide-1"
className="slide-item banner-slide"
variants={variants.bottomToTop}
initial="initial"
animate="animate"
exit="exit"
transition={transition}
>
<div className="bg-layer"
style={{ backgroundImage: 'url(/assets/images/banner/desktopBanner/home-banner-2.webp)' }}>
</div>
<div className="auto-container" style={{height:"600px", display:"flex", alignItems:"end"}}>
<div className="content-box custom-content-box" style={{ backgroundColor: '#ffffff8a', opacity: 0.8, borderRadius: '20px', padding: '30px' }}>
<span className="upper-text">Care That Heals Gently</span>
<h2>Relaxing <span>Massage</span> Therapy</h2>
<p>Experience soothing massage techniques that release tension, promote circulation, and support your overall wellness.</p>
<div className="btn-box mt-3">
<Link href="/contact" className="theme-btn btn-one">
<span>Schedule a Massage</span>
</Link>
</div>
</div>
</div>
</motion.div>
)}
</AnimatePresence>
</SwiperSlide>
{/* Slide 3 */}
<SwiperSlide>
<AnimatePresence mode="wait">
{activeIndex === 2 && (
<motion.div
key="slide-2"
className="slide-item banner-slide"
variants={variants.leftToRight}
initial="initial"
animate="animate"
exit="exit"
transition={transition}
>
<div className="bg-layer"
style={{ backgroundImage: 'url(/assets/images/banner/desktopBanner/home-banner-3.webp)' }}>
</div>
<div className="auto-container" style={{height:"600px", display:"flex", alignItems:"end"}}>
<div className="content-box custom-content-box" style={{ backgroundColor: '#ffffff8a', opacity: 0.8, borderRadius: '20px', padding: '30px' }}>
<span className="upper-text">Wellness Near You Always</span>
<h2>Trusted <span>Physio</span> Experts</h2>
<p>Comprehensive physiotherapy and rehab services designed to restore your strength, mobility, and long-term wellness.</p>
<div className="btn-box mt-3">
<Link href="/etobicoke-treatment-service" className="theme-btn btn-one">
<span>Explore Our Service</span>
</Link>
</div>
</div>
</div>
</motion.div>
)}
</AnimatePresence>
</SwiperSlide>
{/* Slide 4 */}
<SwiperSlide>
<AnimatePresence mode="wait">
{activeIndex === 3 && (
<motion.div
key="slide-3"
className="slide-item banner-slide"
variants={variants.rightToLeft}
initial="initial"
animate="animate"
exit="exit"
transition={transition}
>
<div className="bg-layer"
style={{ backgroundImage: 'url(/assets/images/banner/desktopBanner/home-banner-4.webp)' }}>
</div>
<div className="auto-container" style={{height:"600px", display:"flex", alignItems:"end"}}>
<div className="content-box custom-content-box" style={{ backgroundColor: '#ffffff8a', opacity: 0.8, borderRadius: '20px', padding: '30px' }}>
<span className="upper-text">Healing With Caring Hands</span>
<h2>Holistic <span>Wellness</span> Care</h2>
<p>Discover holistic physiotherapy and rehab services designed to restore balance, ease pain, and support long-term recovery.</p>
<div className="btn-box mt-3">
<Link href="/contact" className="theme-btn btn-one">
<span>Visit Our Location</span>
</Link>
</div>
</div>
</div>
</motion.div>
)}
</AnimatePresence>
</SwiperSlide>
</Swiper>
</section>
);
}