diff --git a/components/Paginator.tsx b/components/Paginator.tsx
index 48aa977..c829d9b 100644
--- a/components/Paginator.tsx
+++ b/components/Paginator.tsx
@@ -5,7 +5,7 @@ const Paginator = ({ currentPage, totalPage, pathname }:PaginatorProps):JSX.Elem
else if(currentPage > totalPage - 3) pages = [ totalPage - 4 < 1 ? null : totalPage - 4, totalPage - 3 < 1 ? null : totalPage - 3, totalPage - 2 < 1 ? null : totalPage - 2, totalPage - 1 < 1 ? null : totalPage - 1, totalPage ]
else pages = [ currentPage - 2 < 1 ? null : currentPage - 2, currentPage - 1 < 1 ? null : currentPage - 1, currentPage, currentPage + 1 > totalPage ? null : currentPage + 1, currentPage + 2 > totalPage ? null : currentPage + 2 ]
pages = pages.filter(el => el)
- return
+ return
@@ -14,7 +14,7 @@ const Paginator = ({ currentPage, totalPage, pathname }:PaginatorProps):JSX.Elem
{
pages.map((el, i) =>
- {el}
+
{el}
)
}
diff --git a/components/Search.tsx b/components/Search.tsx
index 9f8fe24..1121034 100644
--- a/components/Search.tsx
+++ b/components/Search.tsx
@@ -1,14 +1,15 @@
import { useState } from 'react'
+import { useRouter } from 'next/router'
import Link from 'next/link'
-
-import { makeBotURL } from '@utils/Tools'
+import { makeBotURL, redirectTo } from '@utils/Tools'
import Fetch from '@utils/Fetch'
import { BotList, ResponseProps } from '@types'
import DiscordAvatar from '@components/DiscordAvatar'
const Search = (): JSX.Element => {
+ const router = useRouter()
const [ query, setQuery ] = useState('')
const [ data, setData ] = useState
>(null)
const [ loading, setLoading ] = useState(false)
@@ -25,12 +26,20 @@ const Search = (): JSX.Element => {
setLoading(false)
}
- return <>
+
+ const onSubmit = async () => {
+ setHidden(true)
+ redirectTo(router, `/search/?query=${encodeURIComponent(query)}`)
+ }
+
+ return
- ) : loading ? 검색중입니다... : {query && data ? data.errors && data.errors[0] || data.message?.includes('문법') ? <>검색 문법이 잘못되었습니다.
더 알아보기> : data.message : query.length < 3 ? '최소 2글자 이상 입력해주세요.' : '검색어를 입력해주세요.'}
+ ) : loading ? 검색중입니다... : {query && data ? data.message?.includes('문법') ? <>검색 문법이 잘못되었습니다.
더 알아보기> : data.errors && data.errors[0] || data.message : query.length < 3 ? '최소 2글자 이상 입력해주세요.' : '검색어를 입력해주세요.'}
}
- >
+
}
export default Search