2022-01-27 19:18:48 +00:00
|
|
|
import Layout from '../components/layout'
|
|
|
|
import { getGetServerSideProps } from '../api/ssrApollo'
|
|
|
|
import { ITEM_SEARCH } from '../fragments/items'
|
|
|
|
import SearchItems from '../components/search-items'
|
|
|
|
import { useRouter } from 'next/router'
|
2022-02-05 17:29:41 +00:00
|
|
|
import { SeoSearch } from '../components/seo'
|
2022-01-27 19:18:48 +00:00
|
|
|
|
2022-05-18 21:09:44 +00:00
|
|
|
export const getServerSideProps = getGetServerSideProps(ITEM_SEARCH)
|
2022-01-27 19:18:48 +00:00
|
|
|
|
|
|
|
export default function Index ({ data: { search: { items, cursor } } }) {
|
|
|
|
const router = useRouter()
|
2022-01-27 20:31:16 +00:00
|
|
|
|
2022-01-27 19:18:48 +00:00
|
|
|
return (
|
2022-02-05 17:29:41 +00:00
|
|
|
<Layout noSeo>
|
|
|
|
<SeoSearch />
|
2022-05-18 21:09:44 +00:00
|
|
|
{router.query?.q &&
|
|
|
|
<SearchItems
|
|
|
|
items={items} cursor={cursor} variables={{ q: router.query?.q }}
|
|
|
|
/>}
|
2022-01-27 19:18:48 +00:00
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|