import {GetServerSideProps, NextPage} from 'next'
import {USER} from '../utilities/popups'
import {QUERY, POPUP} from '../utilities/queryKeys'
import Template from '../components/templates/Index'

type Props = {
	query: string
}

const Page: NextPage<Props> = ({query}) => {
	return (
		<Template
			query={query}
			userLinkLabel="User"
			searchQueryKey={QUERY}
			searchLabel="Search"
			searchHint="e.g. keywords, names&hellip;"
			popupQueryKey={POPUP}
			userPopupQueryValue={USER}
		/>
	)
}

export default Page

export const getServerSideProps: GetServerSideProps = async (ctx) => {
	const {[QUERY]: query = ''} = ctx.query
	return {
		props: {
			query,
		},
	}
}
