aboutsummaryrefslogtreecommitdiff
path: root/src/app/anime/search/components
diff options
context:
space:
mode:
authorreal-zephex <[email protected]>2024-03-26 13:21:55 +0530
committerreal-zephex <[email protected]>2024-03-26 13:21:55 +0530
commit3acac648ad6f7c220a48ff9f92f42e814c2097ab (patch)
tree894bd3085ca1021566ff68577136305c79bd2ea5 /src/app/anime/search/components
parentidek (diff)
downloaddramalama-3acac648ad6f7c220a48ff9f92f42e814c2097ab.tar.xz
dramalama-3acac648ad6f7c220a48ff9f92f42e814c2097ab.zip
restructured files
Diffstat (limited to 'src/app/anime/search/components')
-rw-r--r--src/app/anime/search/components/fetchInfo.js14
-rw-r--r--src/app/anime/search/components/fetchedInfo.js44
2 files changed, 58 insertions, 0 deletions
diff --git a/src/app/anime/search/components/fetchInfo.js b/src/app/anime/search/components/fetchInfo.js
new file mode 100644
index 0000000..07b203d
--- /dev/null
+++ b/src/app/anime/search/components/fetchInfo.js
@@ -0,0 +1,14 @@
+"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/anime/search/components/fetchedInfo.js b/src/app/anime/search/components/fetchedInfo.js
new file mode 100644
index 0000000..17c9673
--- /dev/null
+++ b/src/app/anime/search/components/fetchedInfo.js
@@ -0,0 +1,44 @@
+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={`/anime/${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>
+ );
+}