From b7e29a3d67e3e214ba1c958478092ee4075e8171 Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Thu, 4 Apr 2024 23:00:53 +0530
Subject: inmidst of rewriting the kdrama section. will complete it soon

---
 src/app/kdrama/components/popular.jsx | 42 +++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 src/app/kdrama/components/popular.jsx

(limited to 'src/app/kdrama/components/popular.jsx')

diff --git a/src/app/kdrama/components/popular.jsx b/src/app/kdrama/components/popular.jsx
new file mode 100644
index 0000000..d9126ec
--- /dev/null
+++ b/src/app/kdrama/components/popular.jsx
@@ -0,0 +1,42 @@
+import styles from "../styles/popular.module.css";
+import Image from "next/image";
+import Link from "next/link";
+
+export default async function PopularDramas() {
+	const popular = await getPopular();
+
+	return (
+		<div className={styles.Main}>
+			<p className={styles.popDramasText}>Popular Dramas</p>
+
+			<div className={styles.AnimeContainer}>
+				{popular &&
+					popular.results.map((item, index) => (
+						<Link
+							href={`/kdrama/${encodeURIComponent(item.id)}`}
+							key={index}
+							style={{ textDecoration: "none" }}
+						>
+							<div className={styles.AnimeEntry}>
+								<Image
+									src={item.image}
+									width={160}
+									height={240}
+									alt="Drama Poster"
+								/>
+								<p>{item.title}</p>
+							</div>
+						</Link>
+					))}
+			</div>
+		</div>
+	);
+}
+
+async function getPopular() {
+	const res = await fetch("https://dramacool-scraper.vercel.app/popular", {
+		next: { revalidate: 86400 },
+	});
+	const data = await res.json();
+	return data;
+}
-- 
cgit v1.2.3

