diff options
| author | Factiven <[email protected]> | 2023-04-14 00:14:12 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-04-14 00:14:12 +0700 |
| commit | 70fda74d27d9b55c9030932794daa25c1e6cf50d (patch) | |
| tree | 0c1f639be4e8ec1b960ba642b8e99c1485e83b1a /pages/components/hero/searchAni.js | |
| parent | Update 5th (diff) | |
| download | moopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.tar.xz moopa-70fda74d27d9b55c9030932794daa25c1e6cf50d.zip | |
Update 6th
Diffstat (limited to 'pages/components/hero/searchAni.js')
| -rw-r--r-- | pages/components/hero/searchAni.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/pages/components/hero/searchAni.js b/pages/components/hero/searchAni.js deleted file mode 100644 index 390165a..0000000 --- a/pages/components/hero/searchAni.js +++ /dev/null @@ -1,64 +0,0 @@ -import React from "react"; -import { useQuery, gql } from "@apollo/client"; -import Link from "next/link"; - -const SearchAni = ({ searchQuery }) => { - const ANIME_QUERY = gql` - query ( - $id: Int - $page: Int - $perPage: Int - $search: String - $sort: [MediaSort] - ) { - Page(page: $page, perPage: $perPage) { - pageInfo { - total - currentPage - lastPage - hasNextPage - perPage - } - media(id: $id, search: $search, sort: $sort, type: ANIME) { - id - idMal - title { - romaji - english - } - coverImage { - large - } - } - } - } - `; - - // use useQuery hook to execute query and get data - const { loading, error, data } = useQuery(ANIME_QUERY, { - variables: { - search: searchQuery, - page: 1, - perPage: 5, - sort: "TRENDING_DESC", - }, - }); - - // render component - if (loading) return <p>Loading...</p>; - if (error) return <p>Error :(</p>; - - const { media } = data.Page; - - // const cleanDescription = description.replace(/<br>/g, '').replace(/\n/g, ' '); - - return ( - <main className="flex flex-col"> - <div className="my-10 mx-[1rem] flex flex-col gap-10 md:mx-auto md:w-full"> - {media.map((anime) => {})} - </div> - </main> - ); -}; - -export default SearchAni; |