Fix site search (#133)

This commit is contained in:
Eric Fennis
2020-11-16 12:05:34 +01:00
committed by GitHub
parent 0dd10483c9
commit 8f1c7eb737
10 changed files with 165 additions and 72 deletions

View File

@@ -1,4 +1,4 @@
import { CSSReset, ChakraProvider, ColorModeProvider } from '@chakra-ui/core';
import { ChakraProvider } from '@chakra-ui/core';
import customTheme from '../lib/theme';
import '../assets/styling.css';
import Head from 'next/head';

View File

@@ -9,11 +9,27 @@ import Header from '../../components/Header';
const IconPage = ({ icon, data }) => {
const router = useRouter()
const onClose = () => {
let query = {};
if(router.query.search) {
query = {
search: router.query.search
};
}
router.push({
pathname: '/',
query,
})
}
return (
<Layout>
<IconDetailOverlay
key={icon.name}
icon={icon}
onClose={() => router.push('/')}
onClose={onClose}
/>
<Header {...{data}}/>
<IconOverview {...{data}}/>