'use client'; import { useEffect, useRef, useState } from 'react'; import { ArrowLeft, ArrowRight, AtSign, CircleUserRound, Globe2, } 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, w: 156, h: 180, y: 0, radius: 'rounded-[28px]', bg: 'bg-pink-100', }, { offset: -2, w: 156, h: 180, y: 80, radius: 'rounded-[28px]', bg: 'bg-neutral-200', }, { offset: -1, w: 156, h: 180, y: 0, radius: 'rounded-[28px]', bg: 'bg-green-100', }, { offset: 0, w: 296, h: 342, y: 0, radius: 'rounded-[40px]', bg: 'bg-blue-100', }, { offset: 1, w: 156, h: 180, y: 0, radius: 'rounded-[28px]', bg: 'bg-orange-100', }, { offset: 2, w: 156, h: 180, y: 80, radius: 'rounded-[28px]', bg: 'bg-purple-100', }, { offset: 3, w: 156, h: 180, y: 0, radius: 'rounded-[28px]', bg: 'bg-yellow-100', }, ]; const MOBILE_SLOTS = [ { offset: -3, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-pink-100', }, { offset: -2, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-neutral-200', }, { offset: -1, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-green-100', }, { offset: 0, w: 220, h: 220, y: 0, radius: 'rounded-[24px]', bg: 'bg-blue-100', }, { offset: 1, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-orange-100', }, { offset: 2, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-purple-100', }, { offset: 3, w: 120, h: 120, y: 0, radius: 'rounded-[20px]', bg: 'bg-yellow-100', }, ]; export default function ProgressMakersTeamCarousel() { const [activeIndex, setActiveIndex] = useState(0); const previousActiveIndexRef = useRef(0); const [isMobile, setIsMobile] = useState(false); useEffect(() => { const mediaQuery = window.matchMedia('(max-width: 1023px)'); const handleChange = (event: MediaQueryListEvent) => { setIsMobile(event.matches); }; setIsMobile(mediaQuery.matches); mediaQuery.addEventListener('change', handleChange); return () => mediaQuery.removeEventListener('change', handleChange); }, []); useEffect(() => { previousActiveIndexRef.current = activeIndex; }, [activeIndex]); const handlePrevious = () => { setActiveIndex( (previous) => (previous - 1 + teamData.length) % teamData.length, ); }; const handleNext = () => { setActiveIndex((previous) => (previous + 1) % teamData.length); }; const activeMember = teamData[activeIndex]; const slots = isMobile ? MOBILE_SLOTS : DESKTOP_SLOTS; const activeHeight = isMobile ? 220 : 342; const gap = isMobile ? 16 : 24; return (
Creative minds united

Get to know the makers of progress

Inspiring change, breaking molds, and fostering teamwork.

{teamData.map((member, index) => { const total = teamData.length; let offset = index - activeIndex; if (offset > total / 2) offset -= total; if (offset < -total / 2) offset += total; let previousOffset = index - previousActiveIndexRef.current; if (previousOffset > total / 2) previousOffset -= total; if (previousOffset < -total / 2) previousOffset += total; const isWrapping = Math.abs(offset - previousOffset) > 1; const slot = slots.find((item) => item.offset === offset); const isVisible = Math.abs(offset) <= 3; const width = slot?.w ?? (isMobile ? 120 : 156); const height = slot?.h ?? (isMobile ? 120 : 180); const yOffset = slot?.y ?? 0; const radius = slot?.radius ?? (isMobile ? 'rounded-[20px]' : 'rounded-[28px]'); const background = slot?.bg ?? 'bg-neutral-200'; const zIndex = isVisible ? 4 - Math.abs(offset) : 0; const centerSlotIndex = slots.findIndex( (item) => item.offset === 0, ); let xOffset = 0; if (offset !== 0) { const direction = offset > 0 ? 1 : -1; const absoluteOffset = Math.abs(offset); xOffset = slots[centerSlotIndex].w / 2 + gap; for (let index = 1; index < absoluteOffset; index += 1) { const currentSlot = slots.find((item) => item.offset === index); xOffset += (currentSlot?.w ?? (isMobile ? 120 : 156)) + gap; } xOffset += width / 2; xOffset *= direction; } return (
{member.name}
); })}
{activeMember.name}
{activeMember.role}
); }