import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
} from "@/components/ui/navigation-menu";
export default function Navbar() {
return (
{/* Logo */}
MyApp
{/* Center Menu */}
Home
Dashboard
About
Our Team
Services
Web Development
Mobile Development
SEO Optimization
Contact
Get in Touch
{/* Login Button */}
);
}
------------------------------
----------------------
{/* Logo */}
LOGO
banksFinders
{/* Navigation */}
Home
setOpenMegaMenu(!openMegaMenu)}
className="flex items-center space-x-1 hover:text-blue-600"
>
Services
{openMegaMenu && (
Service 1
Service 2
Service 3
)}
{/* Mobile Menu */}
Home
Service 1
Service 2
Service 3
About
Contact
------------------------------------
--------------------------
const menuItems = [
{
title: "Credit Card",
href: "/credit-Card",
icon: ,
submenu: [
{
title: "Card Types",
items: [
{ key: "cashback", itemName: "Cash Back", href: "/cash-back" },
{ key: "welcomebonus", itemName: "Welcome Bonus", href: "/welcome-bonus" },
{ key: "freeforlife", itemName: "Free For Life", href: "/free-for-life" },
{ key: "travelcard", itemName: "Travel Card", href: "/travel-card" },
{ key: "premiumcard", itemName: "Premium Card", href: "/premium-card" },
{ key: "etihadmiles", itemName: "Etihad Miles", href: "/etihad-miles" },
{ key: "emirateskywords", itemName: "Emirate SkyWords", href: "/emirate-skywords" },
{ key: "balancetransfer", itemName: "Balance Transfer", href: "/balance-transfer" },
{ key: "fixeddeposit", itemName: "Fixed Deposit", href: "/fixed-deposit" },
{ key: "islamiccard", itemName: "Islamic Card", href: "/islamic-card" },
{ key: "businesscard", itemName: "Business Card", href: "/business-card" }
]},
{
title: "Nationals",
items: [
{
key: "personal-loans-for-uae-nationals",
itemName: "Personal Loans for UAE Nationals",
href: "/personal-loans-for-uae-nationals"
},
{
key: "personal-loan-with-salary-transfer",
itemName: "Personal Loan with Salary Transfer",
href: "/personal-loan-with-salary-transfer"
}
]
},
{
title: "Special Programs",
items: [
{
key: "personal-loan-without-salary-transfer",
itemName: "Personal Loan without Salary Transfer",
href: "/personal-loan-without-salary-transfer"
},
{
key: "personal-loan-for-non-listed-companies",
itemName: "Personal Loan for Non-Listed Companies",
href: "/personal-loan-for-non-listed-companies"
}
]
},
{
title: "Employment Types",
items: [{
key: "personal-loan-for-self-employed",
itemName: "Personal Loan for Self-Employed",
href: "/personal-loan-for-self-employed"
}]
},
],
},
{
title: "Personal Loan",
icon: ,
submenu: [
{
title: "Loan Types",
items: ["Personal Loans in UAE", "Personal Loans for Expats"]
},
{
title: "Nationals",
items: ["Personal Loans for UAE Nationals", "Personal Loan with Salary Transfer"]
},
{
title: "Special Programs",
items: ["Personal Loan without Salary Transfer", "Personal Loan for Non-Listed Companies"]
},
{
title: "Employment Types",
items: ["Personal Loan for Self-Employed"]
},
],
},
{
title: "Car Loans",
icon: ,
submenu: [
{
title: "Car Financing",
items: [
{
key: "car-loans",
itemName: "Car Loans",
href: "/car-loans"
},
{
key: "best-car-loan-in-use",
itemName: "Best Car Loan in Use",
href: "/best-car-loan-in-use"
},
{
key: "used-car-loan",
itemName: "Used Car Loan",
href: "/used-car-loan"
}
]
},
{
title: "Rate & Payment",
items: ["Car Loan Interest Rate in UAE", "Zero Down Payment Car Loan"]
},
{
title: "Home Loans",
items: ["Home Loan", "Home Loans for Expats", "Home Loan Eligibility in UAE"]
},
{
title: "Loan Management",
items: ["Home Loan Pre-Approval in UAE", "Home Loan Balance Transfer in UAE"]
},
],
},
{
title: "Financial Calculators",
icon: ,
submenu: [
{
title: "Calculators",
items: ["Financial Calculators", "Personal Loan Calculator", "Car Loan Calculator"]
}
],
},
];
-----------------------------------------------
'use client';
import React, { useEffect, useRef, useState } from 'react';
import Image from 'next/image';
const cardData = [
{
imgSrc: '/gems-world-card.webp',
title: 'Detail 1',
points: ['Cashback up to 5%', 'No Annual Fee', 'Airport Lounge Access'],
},
{
imgSrc: '/du-titanium-credit-card-2.webp',
title: 'Detail 2',
points: ['Earn Reward Points', 'Fuel Discounts', 'Dining Offers'],
},
{
imgSrc: '/fab-cashback-credit-card.webp',
title: 'Detail 3',
points: ['1% Cashback on All Purchases', 'Low Interest Rate', 'Free Movie Tickets'],
},
{
imgSrc: '/fab-low-rate-credit-card.webp',
title: 'Detail 4',
points: ['0% Balance Transfer', 'No Foreign Transaction Fee', 'Bonus Points on Signup'],
},
{
imgSrc: '/du-titanium-credit-card-2.webp',
title: 'Detail 5',
points: ['Exclusive Travel Benefits', 'Hotel Discounts', 'Priority Customer Support'],
},
{
imgSrc: '/fab-cashback-credit-card.webp',
title: 'Detail 3',
points: ['1% Cashback on All Purchases', 'Low Interest Rate', 'Free Movie Tickets'],
},
{
imgSrc: '/fab-low-rate-credit-card.webp',
title: 'Detail 4',
points: ['0% Balance Transfer', 'No Foreign Transaction Fee', 'Bonus Points on Signup'],
},
{
imgSrc: '/du-titanium-credit-card-2.webp',
title: 'Detail 5',
points: ['Exclusive Travel Benefits', 'Hotel Discounts', 'Priority Customer Support'],
},
{
imgSrc: '/gems-world-card.webp',
title: 'Detail 1',
points: ['Cashback up to 5%', 'No Annual Fee', 'Airport Lounge Access'],
},
{
imgSrc: '/du-titanium-credit-card-2.webp',
title: 'Detail 2',
points: ['Earn Reward Points', 'Fuel Discounts', 'Dining Offers'],
},
];
const CardOfferFirst: React.FC = () => {
const carouselRef = useRef(null);
const [activeIndex, setActiveIndex] = useState(0);
// Calculate total slides based on the number of cards to display per view based on screen size
const getCardsPerSlide = () => {
if (window.innerWidth <= 640) {
return 1; // Mobile view, 1 card per slide
} else if (window.innerWidth <= 1024) {
return 1; // Tablet view, 1 card per slide
} else {
return 5; // Desktop view, 5 cards per slide
}
};
const [cardsPerSlide, setCardsPerSlide] = useState(getCardsPerSlide());
const totalSlides = Math.ceil(cardData.length / cardsPerSlide); // Number of total slides
// Listen for window resizing and update cards per slide accordingly
useEffect(() => {
const handleResize = () => {
setCardsPerSlide(getCardsPerSlide());
};
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);
// Update carousel automatically in a loop without reversing
useEffect(() => {
const interval = setInterval(() => {
setActiveIndex((prev) => (prev + 1) % totalSlides);
}, 10000);
return () => clearInterval(interval);
}, [totalSlides]);
// Scroll to the active index position
useEffect(() => {
if (carouselRef.current) {
carouselRef.current.scrollTo({ left: activeIndex * carouselRef.current.clientWidth, behavior: 'smooth' });
}
}, [activeIndex]);
return (
Best Cash Back Card
{/* ✅ Horizontal Scroll Wrapper */}
{Array.from({ length: totalSlides }).map((_, slideIndex) => (
{cardData.slice(slideIndex * cardsPerSlide, (slideIndex + 1) * cardsPerSlide).map((card, index) => (
{/* ✅ Image */}
{/* ✅ Title */}
{card.title}
{/* ✅ Bulleted List */}
{card.points.map((point, i) => (
{point}
))}
{/* ✅ Buttons Row */}
))}
))}
{/* ✅ Dots Navigation */}
{Array.from({ length: totalSlides }).map((_, i) => (
setActiveIndex(i)}
>
))}
);
};
export default CardOfferFirst;