"use client" import { useState, useEffect, useRef } from "react" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import Link from "next/link" import { artists } from "@/data/artists" const specialties = [ "All", "Traditional", "Realism", "Fine Line", "Japanese", "Geometric", "Blackwork", "Watercolor", "Illustrative", "Cover-ups", "Neo-Traditional", "Anime", ] export function ArtistsPageSection() { const [selectedSpecialty, setSelectedSpecialty] = useState("All") const [visibleCards, setVisibleCards] = useState([]) const [scrollY, setScrollY] = useState(0) const sectionRef = useRef(null) const leftColumnRef = useRef(null) const centerColumnRef = useRef(null) const rightColumnRef = useRef(null) const filteredArtists = selectedSpecialty === "All" ? artists : artists.filter((artist) => artist.styles.some((style) => style.toLowerCase().includes(selectedSpecialty.toLowerCase())), ) useEffect(() => { const observer = new IntersectionObserver( (entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { const cardIndex = Number.parseInt(entry.target.getAttribute("data-index") || "0") setVisibleCards((prev) => [...new Set([...prev, cardIndex])]) } }) }, { threshold: 0.1, rootMargin: "0px 0px -50px 0px" }, ) const cards = sectionRef.current?.querySelectorAll("[data-index]") cards?.forEach((card) => observer.observe(card)) return () => observer.disconnect() }, [filteredArtists]) useEffect(() => { let ticking = false const handleScroll = () => { if (!ticking) { requestAnimationFrame(() => { const scrollTop = window.pageYOffset setScrollY(scrollTop) ticking = false }) ticking = true } } window.addEventListener("scroll", handleScroll, { passive: true }) return () => window.removeEventListener("scroll", handleScroll) }, []) useEffect(() => { if (leftColumnRef.current && centerColumnRef.current && rightColumnRef.current) { const sectionTop = sectionRef.current?.offsetTop || 0 const relativeScroll = scrollY - sectionTop leftColumnRef.current.style.transform = `translateY(${relativeScroll * -0.05}px)` centerColumnRef.current.style.transform = `translateY(0px)` rightColumnRef.current.style.transform = `translateY(${relativeScroll * 0.05}px)` const leftImages = leftColumnRef.current.querySelectorAll(".artist-image") const centerImages = centerColumnRef.current.querySelectorAll(".artist-image") const rightImages = rightColumnRef.current.querySelectorAll(".artist-image") leftImages.forEach((img) => { ;(img as HTMLElement).style.transform = `translateY(${relativeScroll * -0.02}px)` }) centerImages.forEach((img) => { ;(img as HTMLElement).style.transform = `translateY(${relativeScroll * -0.015}px)` }) rightImages.forEach((img) => { ;(img as HTMLElement).style.transform = `translateY(${relativeScroll * -0.01}px)` }) } }, [scrollY]) const leftColumn = filteredArtists.filter((_, index) => index % 3 === 0) const centerColumn = filteredArtists.filter((_, index) => index % 3 === 1) const rightColumn = filteredArtists.filter((_, index) => index % 3 === 2) return (
{/* Background */}
{/* Header */}

OUR ARTISTS

Meet our exceptional team of tattoo artists, each bringing unique expertise and artistic vision to create your perfect tattoo.

{/* Filter Buttons */}
{specialties.map((specialty) => ( ))}
{/* Artists Grid with Parallax */}
{leftColumn.map((artist, index) => (
{`${artist.name}
{`${artist.name}
{artist.experience} {artist.availability}

{artist.name}

{artist.specialty}

{artist.bio}

★ {artist.rating} ({artist.reviews} reviews)
))}
{centerColumn.map((artist, index) => (
{`${artist.name}
{`${artist.name}
{artist.experience} {artist.availability}

{artist.name}

{artist.specialty}

{artist.bio}

★ {artist.rating} ({artist.reviews} reviews)
))}
{rightColumn.map((artist, index) => (
{`${artist.name}
{`${artist.name}
{artist.experience} {artist.availability}

{artist.name}

{artist.specialty}

{artist.bio}

★ {artist.rating} ({artist.reviews} reviews)
))}
{/* Call to Action */}

READY?

Choose your artist and start your tattoo journey with United Tattoo.

) }