diff --git a/pages/search.tsx b/pages/search.tsx index 9ea5f755c..bea5b6097 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -1,34 +1,31 @@ -import Head from 'next/head' -import React, { useEffect } from 'react' -import { useRouter } from 'next/router' - -import CardsList from 'components/Cards/CardsList' -import { TopBar } from 'components/TopBar/TopBar' -import ComingSoon from 'components/NewIssue/NewIssue' - -import useFilterSearch from 'hooks/useFilterSearch' +import React, { useEffect } from 'react'; +import { useRouter } from 'next/router'; +import Head from 'next/head'; +import CardsList from 'components/Cards/CardsList'; +import { TopBar } from 'components/TopBar/TopBar'; +import ComingSoon from 'components/NewIssue/NewIssue'; +import useFilterSearch from 'hooks/useFilterSearch'; const Search = () => { - const router = useRouter() - const title = `LinksHub - ${router.asPath - .charAt(1) - .toUpperCase()}${router.asPath.slice(2)}` - const query = router.query.query - const { filterSearch } = useFilterSearch() + const router = useRouter(); + const query = router.query.query; + const { filterSearch } = useFilterSearch(); useEffect(() => { - if (!query || query === '') router.replace('/') - }, [query, router]) + if (!query || query === '') router.replace('/'); + }, [query, router]); - let content: JSX.Element[] | JSX.Element + const data = filterSearch(query as string); - const data = filterSearch(query as string) + const title = `LinksHub - ${ + router.asPath.charAt(1).toUpperCase() + router.asPath.slice(2) + }`; - if (data.length > 0) { - content = - } else { - content = - } + const content = data.length > 0 ? ( + + ) : ( + + ); return ( <> @@ -88,13 +85,14 @@ const Search = () => { property="discord:invite" content="https://discord.com/invite/NvK67YnJX5" /> +
{content}
- ) -} + ); +}; -export default Search +export default Search;