import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import _ from 'lodash-contrib'
import Seo from '@/core/components/Seo'

const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout'))
const ProductSearch = dynamic(() => import('@/lib/product/components/ProductSearch'))

export default function Search() {
  const router = useRouter()

  return (
    <BasicLayout>
      <Seo title={`Cari produk ${router.query.q} di Indoteknik.com`} />

      {!_.isEmpty(router.query) && (
        <ProductSearch
          query={router.query}
          prefixUrl='/shop/search'
        />
      )}
    </BasicLayout>
  )
}
