export const ProductTiles = ({ categories, hideButtons = false }) => { const [activeCategory, setActiveCategory] = useState(categories[0].id) const [activeSubTab, setActiveSubTab] = useState( categories[0].items[0]?.id ?? null ) const currentCategory = categories.find((cat) => cat.id === activeCategory) const currentSub = currentCategory?.items.find( (item) => item.id === activeSubTab ) return (
{!hideButtons && (
{categories.map((cat) => ( ))}
)}
{currentCategory?.items?.length ? (
{currentCategory.items.map((item) => ( setActiveSubTab(item.id)} className={`flex items-start gap-1.5 text-left px-5 py-3 rounded-2xl transition-all ${activeSubTab === item.id ? 'bg-white dark:bg-white/5' : '' }`} >
{item.title}

{item.title}

{item.desc}

))}
{currentSub?.image ? ( <> {currentSub.title} {currentSub.title} ) : (

No preview available

)}
) : (

No features available for this category.

)}
) }