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'
|
2023-05-02 16:55:10 +00:00
|
|
|
import Down from '../svgs/arrow-down-line.svg'
|
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 (
|
2023-05-01 20:58:30 +00:00
|
|
|
<Layout noSeo search>
|
2022-02-05 17:29:41 +00:00
|
|
|
<SeoSearch />
|
2023-05-02 16:55:10 +00:00
|
|
|
{router.query?.q
|
|
|
|
? <SearchItems
|
|
|
|
items={items} cursor={cursor}
|
|
|
|
variables={{ q: router.query?.q, sort: router.query?.sort, what: router.query?.what, when: router.query?.when }}
|
|
|
|
/>
|
|
|
|
: (
|
|
|
|
<div className='text-muted text-center mt-5' style={{ fontFamily: 'lightning', fontSize: '2rem', opacity: '0.75' }}>
|
|
|
|
<Down width={22} height={22} className='mr-2' />search for something<Down width={22} height={22} className='ml-2' />
|
|
|
|
</div>)}
|
2022-01-27 19:18:48 +00:00
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|