import { PageOptions } from '@graphcommerce/framer-next-pages' import { ProductListDocument, ProductListQuery } from '@graphcommerce/magento-product' import { StoreConfigDocument } from '@graphcommerce/magento-store' import { AppShellTitle, GetStaticProps, Title } from '@graphcommerce/next-ui' import SidebarGallery from '@graphcommerce/next-ui/FramerScroller/components/SidebarGallery' import React from 'react' import FullPageShell, { FullPageShellProps } from '../../components/AppShell/FullPageShell' import FullPageShellHeader from '../../components/AppShell/FullPageShellHeader' import apolloClient from '../../lib/apolloClient' type Props = ProductListQuery type GetPageStaticProps = GetStaticProps function TestSlider({ products }: Props) { if (!products?.items?.length) return <> return ( <> Product title Product Title } images={ products?.items?.map((item) => ({ src: item?.small_image?.url ?? '', width: 1532, height: 1678, })) ?? [] } />
















{/* Multi item slider Single item Slider */} ) } TestSlider.pageOptions = { SharedComponent: FullPageShell, } as PageOptions export default TestSlider export const getStaticProps: GetPageStaticProps = async ({ locale }) => { const client = apolloClient(locale, true) const staticClient = apolloClient(locale) const conf = client.query({ query: StoreConfigDocument }) // todo(paales): Remove when https://github.com/Urigo/graphql-mesh/issues/1257 is resolved const categoryUid = String((await conf).data.storeConfig?.root_category_uid ?? '') const productList = staticClient.query({ query: ProductListDocument, variables: { categoryUid, pageSize: 8, filters: { category_uid: { eq: 'MTAy' } } }, }) return { props: { ...(await productList).data, apolloState: await conf.then(() => client.cache.extract()), }, } }