Skip to content

Commit

Permalink
Added Popular Anime Section (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSGJ committed Mar 8, 2023
1 parent b14620c commit 06b74b2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import RecentReleaseComponent from '@/components/recent-release';
import { enimeApi } from '@/lib/constant';
import Arrow from '@/components/arrow';
import PopularAnime from '@/components/popular-anime';

export default async function Home() {
const { data, meta } = await (await fetch(enimeApi + "/recent?perPage=100&language=JP", { cache: "no-store" })).json();

let popularAnimeResult = await (await fetch(enimeApi + "/popular?perPage=10", { cache: "no-store" })).json();
const popularAnimeData = popularAnimeResult.data;
return (
<>
<div className="ml-[1%]">
<p className="font-bold text-4xl mt-10 pl-5 mb-2">Recently Released</p>
<p className="font-bold text-4xl mt-10 pl-5 mb-2">Most Popular</p>
<Arrow>
<PopularAnime animes={popularAnimeData} />
</Arrow>
<p className="font-bold text-4xl mt-4 pl-5 mb-2">Recently Released</p>
<Arrow>
<RecentReleaseComponent data={data} meta={meta}/>
</Arrow>
Expand Down
17 changes: 17 additions & 0 deletions components/popular-anime/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import AnimeCard from '../anime-card';

export default function PopularAnime({animes}) {

return (
<div className="grid grid-rows-1 col-auto row-auto grid-flow-col-dense m-0 overflow-x-scroll w-full pr-5 pl-5 gap-x-3">
{animes.map(
anime => {
return (
<a key={anime.id} href={`/anime/${anime.slug}/`} className="p-0 m-0">
<AnimeCard anime={anime}/>
</a>
)
})}
</div>
)
}

0 comments on commit 06b74b2

Please sign in to comment.