aboutsummaryrefslogtreecommitdiff
path: root/src/app/search
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/search')
-rw-r--r--src/app/search/components/fetchInfo.js14
-rw-r--r--src/app/search/components/fetchedInfo.js44
-rw-r--r--src/app/search/page.jsx67
-rw-r--r--src/app/search/search.css80
4 files changed, 0 insertions, 205 deletions
diff --git a/src/app/search/components/fetchInfo.js b/src/app/search/components/fetchInfo.js
deleted file mode 100644
index 07b203d..0000000
--- a/src/app/search/components/fetchInfo.js
+++ /dev/null
@@ -1,14 +0,0 @@
-"use server";
-
-export default async function Results(id) {
- return await testFunction(id);
-}
-
-async function testFunction(title) {
- const res = await fetch(
- "https://consumet-api-di2e.onrender.com/anime/gogoanime/" + title,
- { cache: "force-cache" }
- );
- const data = await res.json();
- return data;
-}
diff --git a/src/app/search/components/fetchedInfo.js b/src/app/search/components/fetchedInfo.js
deleted file mode 100644
index aa03437..0000000
--- a/src/app/search/components/fetchedInfo.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import "../search.css";
-import Link from "next/link";
-import Image from "next/image";
-
-export default async function fetchedInfo(data) {
- return (
- <div className="animeEntry">
- {data ? (
- data.results && data.results.length > 0 ? (
- data.results.map((item, index) => (
- <Link
- key={index}
- href={`/info/${item.id}`}
- style={{ textDecoration: "none" }}
- >
- <div className="anime">
- <p>{item.title}</p>
- <Image
- src={item.image}
- className="animeImage"
- width={120}
- height={160}
- alt="Drama Poster"
- />
- </div>
- </Link>
- ))
- ) : (
- <div style={{ margin: "0px auto" }}>
- <p
- style={{
- color: "white",
- fontFamily: "Kanit",
- fontSize: 18,
- }}
- >
- No results found
- </p>
- </div>
- )
- ) : null}
- </div>
- );
-}
diff --git a/src/app/search/page.jsx b/src/app/search/page.jsx
deleted file mode 100644
index 75f09bd..0000000
--- a/src/app/search/page.jsx
+++ /dev/null
@@ -1,67 +0,0 @@
-"use client";
-
-import "./search.css";
-import { FaSearch } from "react-icons/fa"; // Import the search icon from react-icons library
-import { useState } from "react";
-import Results from "./components/fetchInfo";
-import fetchedInfo from "./components/fetchedInfo";
-
-export default function Input() {
- const [searchedAnime, setSearchedAnime] = useState(null);
- const [loading, setLoading] = useState(null);
- const [info, setInfo] = useState(null);
-
- const handleKeyPress = async (event) => {
- if (
- (event.code === "Enter" ||
- event.key === "Enter" ||
- event.code === 13) &&
- searchedAnime !== ""
- ) {
- setLoading(true);
- setInfo(await fetchedInfo(await Results(searchedAnime)));
- setLoading(false);
- } else if (
- (event.code === "Enter" ||
- event.key === "Enter" ||
- event.code === 13) &&
- searchedAnime === ""
- ) {
- alert("Input cannot be empty");
- }
- };
-
- return (
- <div>
- <div className="inputContainer">
- <div className="searchContainer">
- <FaSearch className="searchIcon" />
- <input
- onChange={(event) => {
- if (event.target.value.trim() !== "") {
- setSearchedAnime(event.target.value);
- }
- }}
- onKeyDown={(event) => handleKeyPress(event)}
- placeholder="Enter anime title"
- ></input>
- </div>
- </div>
-
- {loading && (
- <p
- style={{
- textAlign: "center",
- fontFamily: "Kanit",
- fontSize: 18,
- color: "white",
- }}
- >
- Please wait while we crunch all the data for you
- </p>
- )}
-
- {info}
- </div>
- );
-}
diff --git a/src/app/search/search.css b/src/app/search/search.css
deleted file mode 100644
index 8afb508..0000000
--- a/src/app/search/search.css
+++ /dev/null
@@ -1,80 +0,0 @@
-.inputContainer {
- display: flex;
- margin: 30px auto;
-}
-
-.searchContainer input {
- border: none;
- border-radius: 5px;
- color: white;
- outline: none;
- background: none;
- width: 100%;
- font-family: "Lato";
- font-size: 16px;
-}
-
-.searchContainer {
- display: flex;
- align-items: center;
- margin: 0px auto;
- background-color: #2c2c2c;
- padding: 8px;
- border-radius: 5px;
- width: 20%;
-}
-
-.searchIcon {
- color: white;
- margin-right: 5px;
-}
-
-.animeEntry {
- display: flex;
- overflow-x: auto;
-}
-
-.animeEntry::-webkit-scrollbar {
- height: 7px;
-}
-
-.animeEntry::-webkit-scrollbar-track {
- background-color: #636363;
- border-radius: 5px;
-}
-
-.animeEntry::-webkit-scrollbar-thumb {
- background-color: rgba(196, 196, 196, 0.692);
- border-radius: 5px;
-
-}
-
-.anime {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 10px;
- border-style: dotted;
- border-color: #636363;
- margin: 10px;
- border-radius: 10px;
- border-width: 4px;
-}
-
-.anime p {
- color: white;
- width: 25dvh;
- font-family: "Lato";
- font-size: 18px;
-}
-
-.animeImage {
- border-radius: 10px;
- margin-left: 20px;
-}
-
-@media screen and (max-width: 768px) {
- .searchContainer {
- width: 70%;
- }
-} \ No newline at end of file