import 'server-only';
import Link from 'next/link';
import Image from 'next/image';
import { getCollectionProducts, getMenu } from 'lib/shopify';
import styles from './styles.module.scss';
import { PriceRanges } from '/components/price';
export async function HomeProduct({ product }) {
const typesMenu = await getMenu('types-nav');
const types = typesMenu?.map(item => /search\/(\w+)/.exec(item?.path)?.[1]);
const featuredImage = product?.images?.[0];
const collections = product?.collections?.nodes
?.map(col => col?.title)
?.filter(col => types?.includes(col?.toLowerCase()));
return (
{/* TODO: optimize srcset (adjusting based on featured status) */}
{product?.title}
{collections && collections.length > 0 && ({`(${collections.join( ', ' )})`}
)}{`No products found`}
) : (Filter: {typesMenu?.map((menuItem, i) => ( {`${menuItem?.title}`} {`${ i == typesMenu.length - 1 ? '.' : ',' } `} ))}
); } export const HomeNav = () => (