'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: 2000, disableOnInteraction: false, pauseOnMouseEnter: true, // stops on hover for smooth UX }, speed: 1500, // increase speed for smoother sliding loop: true, navigation: { nextEl: '.h1n', prevEl: '.h1p', }, pagination: { el: '.swiper-pagination', clickable: true, }, effect: "slide", // ensures smooth slide effect }; 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, transition: { duration: 0.8, // adjust speed ease: "easeInOut" // try "easeOut", "easeIn", or custom [0.4, 0, 0.2, 1] } }, exit: { x: "-100vw", opacity: 0, transition: { duration: 0.6, ease: "easeInOut" } } }, }; const revealVariants = { hidden: { scaleX: 0, opacity: 0, originX: 0, // same as transform-origin: 0% 50% }, visible: { scaleX: 1, opacity: 1, originX: 0, transition: { duration: 0.8, ease: "easeInOut" } }, exit: { scaleX: 0, opacity: 0, originX: 0, transition: { duration: 0.6, ease: "easeInOut" } } }; 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 (
setActiveIndex(swiper.realIndex || 0)} onSlideChange={handleSlideChange} > {/* ✅ 4th slide moved to 1st position */} {activeIndex === 0 && (
Begin your

Recovery

• Rehab • Strength Training • Personalized Care

Visit Our Location
)}
{/* ✅ 1st slide moved to 2nd position */} {activeIndex === 1 && (
Build Your Strength &

Endurance

• Physiotherapy • Sports Therapy • Injury Prevention

Book Your Appointment
)}
{/* ✅ existing 3rd slide remains as 3rd */} {activeIndex === 2 && (
Regain your

Flexiblity and Balance

• Pain Relief • Strength Training • Active Care

Explore Our Service
)}
{/* ✅ 2nd slide moved to 4th position */} {activeIndex === 3 && (
Build your Core

Performance

• Pain Relief • Active Care • Long-Term Result

Schedule a Massage
)}
); }