"use client"; import { projects8 } from "@/data/projects"; import Image from "next/image"; import Link from "next/link"; import React, { useEffect, useRef, useState } from "react"; const filters = [ { name: "All", filter: "*", active: true }, { name: "Concept", filter: ".concept" }, { name: "Product", filter: ".product" }, { name: "Workshop", filter: ".workshop" }, { name: "Still Life", filter: ".still-life" }, ]; export default function Projects3() { const [activeFilter, setActiveFilter] = useState("*"); const isotopRef = useRef(null); // Handle filter item click const updateCategory = (val) => { isotopRef.current.arrange({ filter: val, }); // isotope.value.layout(); }; const handleFilterClick = (dataFilter) => { setActiveFilter(dataFilter); updateCategory(dataFilter); // You can add additional logic here, like filtering content based on the selected filter }; const isotopContainer = useRef(); const initIsotop = async () => { const Isotope = (await import("isotope-layout")).default; const imagesloaded = (await import("imagesloaded")).default; // Initialize Isotope in the mounted hook isotopRef.current = new Isotope(isotopContainer.current, { itemSelector: ".item", layoutMode: "masonry", // or 'fitRows', depending on your layout needs }); imagesloaded(isotopContainer.current).on( "progress", function (instance, image) { // Trigger Isotope layout isotopRef.current.layout(); } ); }; useEffect(() => { ///////////////////////////////////////////////////// // Magnate Animation setTimeout(() => { initIsotop(); }, 100); }, []); return (

Filter:

{projects8.map((project, index) => (
image
{project.category}

{project.title}

))}
{/* /.row */}
{/* /.grid */}
{/* /.container */}
); }