-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
611 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
import { Image } from "astro:assets"; | ||
import { format } from "date-fns"; | ||
import Link from "../ui/Link.astro"; | ||
type Props = AllTrending; | ||
const { | ||
media_type, | ||
id, | ||
first_air_date, | ||
original_name, | ||
original_title, | ||
release_date, | ||
poster_path, | ||
} = Astro.props; | ||
--- | ||
|
||
<article | ||
class="w-full card flex flex-col h-full rounded-md" | ||
transition:name={`${media_type} ${id} card`} | ||
> | ||
<Link href={`/${media_type}/${id}`} class="flex flex-col h-full"> | ||
{ | ||
poster_path === undefined || poster_path === null ? ( | ||
<div | ||
class="w-full aspect-[1/1.5] bg-slate-500 bg-opacity-45 rounded-t-md" | ||
transition:name={`${media_type} ${id} poster`} | ||
/> | ||
) : ( | ||
<Image | ||
src={`${import.meta.env.PUBLIC_TMDB_IMG_URL}${poster_path}`} | ||
alt="Poster" | ||
loading="lazy" | ||
inferSize={true} | ||
class="w-full aspect-auto rounded-t-md" | ||
transition:name={`${media_type} ${id} poster`} | ||
/> | ||
) | ||
} | ||
|
||
<div class="p-3 flex-grow"> | ||
<h1 transition:name={`${media_type} ${id} title`} class="text-lg"> | ||
{original_title || original_name} | ||
</h1> | ||
<p transition:name={`${media_type} ${id} date`}> | ||
{ | ||
release_date | ||
? format( | ||
release_date ? new Date(release_date) : new Date(), | ||
"MMMM dd, yyyy" | ||
) | ||
: format( | ||
first_air_date ? new Date(first_air_date) : new Date(), | ||
"MMMM dd, yyyy" | ||
) | ||
} | ||
</p> | ||
</div> | ||
</Link> | ||
</article> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
import Link from "../ui/Link.astro"; | ||
import { getTrendingDatas } from "@/utils/data"; | ||
import Card from "@/components/AllTrending/Card.astro"; | ||
const type = "all"; | ||
const time = "day"; | ||
const datas = await getTrendingDatas(type, time, 1); | ||
--- | ||
|
||
<main> | ||
<section class="w-full"> | ||
<div class="w-full flex justify-between items-center"> | ||
<h1 class="text-2xl font-bold">Trending All</h1> | ||
<Link | ||
href={`/trending?page=1&type=${type}&time=${time}`} | ||
class="text-blue-600 text-lg hover:text-xl transition-all duration-300 ease-linear" | ||
>See more</Link | ||
> | ||
</div> | ||
<section class="w-full mt-3 grid grid-cols-4 gap-4"> | ||
{datas.results.map((data: AllTrending) => <Card {...data} />)} | ||
</section> | ||
</section> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.