import Image from 'next/image';
import xss from 'xss';
import { getProducts, getProduct } from 'commerce/shopify';
import styles from './styles.module.scss';
import PurchaseInput from '/components/product/purchase-input.js';
import { getTags, listTags } from '/util';
//TODO: NumberInput
const ImageScroll = ({ images }) => (
{images?.length > 1 && (
Scroll to right ( → )
)}
{images?.map(image => (
))}
);
const ProductPane = async ({ product }) => {
const tags = await getTags({ product });
return (
{product?.handle ? (
{product?.title}
{tags && tags.length > 0 && (
{listTags({ tags })}
)}
) : (
Product not found
)}
);
};
export default async function ProductPage({ params: { handle } }) {
const product = await getProduct(handle);
return (
);
}
export async function generateStaticParams() {
const products = await getProducts({
sortKey: 'UPDATED_AT',
reverse: false,
query: '',
});
return products.map(product => ({ product: product.handle }));
}