'use client'; import { useEffect, useRef, useState } from 'react'; import { AtSign, ChevronLeft, ChevronRight, CircleUserRound, Globe, } from 'lucide-react'; import Image from 'next/image'; import Link from 'next/link'; import * as Badge from '@/components/ui/badge'; import { cn } from '@/utils/cn'; const teamData = [ { id: 'member1', name: 'James Turner', role: 'Brand Strategy Director', image: 'https://alignui.com/images/blocks/teams-5-image-4.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member5', name: 'Sarah Bennett', role: 'Brand Strategy Director', image: 'https://alignui.com/images/blocks/teams-5-image-5.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member6', name: 'Daniel Kim', role: 'Creative Marketing Partner', image: 'https://alignui.com/images/blocks/teams-5-image-6.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member7', name: 'Sophia Williams', role: 'Experience Innovation Lead', image: 'https://alignui.com/images/blocks/teams-5-image-7.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member4', name: 'Emily Park', role: 'Digital Solutions Expert', image: 'https://alignui.com/images/blocks/teams-5-image-1.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member2', name: 'Ommar Johnson', role: 'Product Designer', image: 'https://alignui.com/images/blocks/teams-5-image-2.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, { id: 'member3', name: 'Emma Wright', role: 'Experience Innovation Lead', image: 'https://alignui.com/images/blocks/teams-5-image-3.png', socials: { instagram: '/', facebook: '/', twitter: '/', }, }, ]; const DESKTOP_SLOTS = [ { offset: -3, size: 200, radius: 'rounded-[40px]' }, { offset: -2, size: 200, radius: 'rounded-[40px]' }, { offset: -1, size: 200, radius: 'rounded-[40px]' }, { offset: 0, size: 340, radius: 'rounded-[40px]' }, { offset: 1, size: 200, radius: 'rounded-[40px]' }, { offset: 2, size: 200, radius: 'rounded-[40px]' }, { offset: 3, size: 200, radius: 'rounded-[40px]' }, ]; const MOBILE_SLOTS = [ { offset: -3, size: 120, radius: 'rounded-[20px]' }, { offset: -2, size: 120, radius: 'rounded-[20px]' }, { offset: -1, size: 120, radius: 'rounded-[20px]' }, { offset: 0, size: 220, radius: 'rounded-[24px]' }, { offset: 1, size: 120, radius: 'rounded-[20px]' }, { offset: 2, size: 120, radius: 'rounded-[20px]' }, { offset: 3, size: 120, radius: 'rounded-[20px]' }, ]; export default function TeamCarouselSpotlight() { const [activeIndex, setActiveIndex] = useState(0); const prevActiveIndexRef = useRef(0); const [isMobile, setIsMobile] = useState(false); useEffect(() => { const mq = window.matchMedia('(max-width: 1023px)'); setIsMobile(mq.matches); const handler = (e: MediaQueryListEvent) => setIsMobile(e.matches); mq.addEventListener('change', handler); return () => mq.removeEventListener('change', handler); }, []); useEffect(() => { prevActiveIndexRef.current = activeIndex; }, [activeIndex]); const handlePrev = () => { setActiveIndex((prev) => (prev - 1 + teamData.length) % teamData.length); }; const handleNext = () => { setActiveIndex((prev) => (prev + 1) % teamData.length); }; const activeMember = teamData[activeIndex]; const SLOTS = isMobile ? MOBILE_SLOTS : DESKTOP_SLOTS; const activeSize = isMobile ? 220 : 340; const GAP = 16; return (
Creative minds united

Uniting strengths for greater impact

Expertise, fresh ideas, and a commitment to excellence.

{teamData.map((member, idx) => { const total = teamData.length; let offset = idx - activeIndex; if (offset > total / 2) offset -= total; if (offset < -total / 2) offset += total; let prevOffset = idx - prevActiveIndexRef.current; if (prevOffset > total / 2) prevOffset -= total; if (prevOffset < -total / 2) prevOffset += total; const isWrapping = Math.abs(offset - prevOffset) > 1; const slot = SLOTS.find((s) => s.offset === offset); const isVisible = Math.abs(offset) <= 3; const isActive = offset === 0; const size = slot?.size ?? (isMobile ? 120 : 200); const radius = slot?.radius ?? (isMobile ? 'rounded-[20px]' : 'rounded-[40px]'); const zIndex = isVisible ? 4 - Math.abs(offset) : 0; const centerSlotIdx = SLOTS.findIndex((s) => s.offset === 0); let xOffset = 0; if (offset !== 0) { const dir = offset > 0 ? 1 : -1; const absOff = Math.abs(offset); xOffset = SLOTS[centerSlotIdx].size / 2 + GAP; for (let i = 1; i < absOff; i++) { const s = SLOTS.find((s) => s.offset === i); xOffset += (s?.size ?? (isMobile ? 120 : 200)) + GAP; } xOffset += size / 2; xOffset *= dir; } return (
{member.name}
); })}
{activeMember.name}
{activeMember.role}
); }