"use client"; import { t } from "@/utils"; import CustomLink from "@/components/Common/CustomLink"; import ProductCard from "@/components/Common/ProductCard"; import { Fragment } from "react"; const FeaturedSections = ({ featuredData, setFeaturedData, allEmpty }) => { const handleLike = (id) => { const updatedData = featuredData.map((section) => { const updatedSectionData = section.section_data.map((item) => { if (item.id === id) { return { ...item, is_liked: !item.is_liked }; } return item; }); return { ...section, section_data: updatedSectionData }; }); setFeaturedData(updatedData); }; return ( featuredData && featuredData.length > 0 && !allEmpty && (
{featuredData.map( (ele) => ele?.section_data.length > 0 && (
{ele?.translated_name || ele?.title}
{ele?.section_data.length > 4 && ( {t("viewAll")} )}
{ele?.section_data.slice(0, 4).map((data) => ( ))}
) )}
) ); }; export default FeaturedSections;