👔 feat: add title and additional attributes to card

This commit is contained in:
2026-03-15 21:11:20 +07:00
parent 8393e6393c
commit 5cb3b909be
6 changed files with 79 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import React from "react";
const layout = ({ children }: Readonly<{ children: React.ReactNode }>) => { const layout = ({ children }: Readonly<{ children: React.ReactNode }>) => {
return ( return (
<div className="max-w-400 mx-auto relative"> <div className="max-w-396 mx-auto relative">
<Navbar /> <Navbar />
<div className="pt-16">{children}</div> <div className="pt-16">{children}</div>
</div> </div>

View File

@ -146,3 +146,54 @@
border-radius: 9px; border-radius: 9px;
border: 3px none #000000; border: 3px none #000000;
} }
@keyframes aircraft-strobe {
/* Kedipan 1: Agak lambat/lama */
0%,
20% {
opacity: 1;
}
/* Jeda singkat */
35% {
opacity: 0;
}
/* Kedipan 2: Cepat */
40% {
opacity: 1;
}
43% {
opacity: 0;
}
/* Jeda sangat singkat */
48% {
opacity: 0;
}
/* Kedipan 3: Cepat */
53% {
opacity: 1;
}
56% {
opacity: 0;
}
/* Jeda panjang sebelum mengulang loop (gelap) */
100% {
opacity: 1;
}
}
/* Class untuk diterapkan ke elemen */
.blink-strobe {
animation: aircraft-strobe 2s linear infinite;
}
.hide-scrollbar {
scrollbar-width: none; /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
display: none; /* Chrome, Edge, Safari */
}

View File

@ -121,7 +121,8 @@ export const getRecommendationAnimeAction = async (): Promise<
thumbnail_url: "https://myanimelist.net/images/anime/1046/122722.jpg", thumbnail_url: "https://myanimelist.net/images/anime/1046/122722.jpg",
}, },
{ {
title: "Mobile Suit Gundam: The Origin", title:
"Mobile Suit Gundam: The Origin (lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua)",
rating: 8.42, rating: 8.42,
type: "OVA", type: "OVA",
status: "finished", status: "finished",

View File

@ -1,14 +1,24 @@
import { RecommendationAnime } from "@/features/home/actions/getRecommenationAnime"; import { RecommendationAnime } from "@/features/home/actions/getRecommenationAnime";
import { Icon } from "@iconify/react"; import { Icon } from "@iconify/react";
import { StarOff } from "lucide-react";
const AnimeRecommendationCard = ({ data }: { data: RecommendationAnime }) => { const AnimeRecommendationCard = ({ data }: { data: RecommendationAnime }) => {
return ( return (
<div> <div>
<div className="w-64 h-88 rounded-lg overflow-hidden relative"> <div className="w-64 h-88 rounded-lg overflow-hidden relative">
<div className="absolute right-2 top-2 bg-amber-400 text-neutral-950 font-semibold flex gap-0.5 items-center py-1 px-2 rounded"> {data.status === "airing" && (
<div className="absolute top-2 left-2 bg-neutral-800 flex items-center gap-0.5 px-2 py-1 rounded-full">
<Icon
icon="icon-park-outline:dot"
className="h-auto w-4 text-red-500 blink-strobe"
/>
<span className="text-xs font-medium">Airing</span>
</div>
)}
<div className="absolute right-2 top-2 bg-amber-400 text-neutral-950 flex items-center py-1 px-1.5 rounded">
<Icon icon="material-symbols:star-rounded" className="h-auto w-4" /> <Icon icon="material-symbols:star-rounded" className="h-auto w-4" />
<span className="text-sm tracking-tight">{data.rating ?? "N/A"}</span> <span className="text-xs tracking-tight font-medium">
{data.rating ?? "N/A"}
</span>
</div> </div>
<img <img
className="w-full h-full object-cover" className="w-full h-full object-cover"
@ -17,6 +27,12 @@ const AnimeRecommendationCard = ({ data }: { data: RecommendationAnime }) => {
draggable={false} draggable={false}
/> />
</div> </div>
<div className="mt-3 px-1 mb-1">
<h3 className=" font-semibold mt-1 line-clamp-1">{data.title}</h3>
<div className="flex gap-2 text-sm text-neutral-400 mt-0.5">
<span>{data.release_year}</span>
</div>
</div>
</div> </div>
); );
}; };

View File

@ -5,7 +5,7 @@ const RecommendationMain = async () => {
const data = async () => await getRecommendationAnimeAction(); const data = async () => await getRecommendationAnimeAction();
const result = await data(); const result = await data();
return ( return (
<div className="flex gap-2 w-full overflow-x-scroll py-2 my-2"> <div className="flex gap-2 w-full overflow-x-scroll py-2 my-2 hide-scrollbar">
{result.map((item, index) => ( {result.map((item, index) => (
<AnimeRecommendationCard data={item} key={index} /> <AnimeRecommendationCard data={item} key={index} />
))} ))}

View File

@ -1,15 +1,15 @@
import { Suspense } from "react"; import { Suspense } from "react";
import RecommendationMain from "./main"; import RecommendationMain from "./main";
import RecommendationSkeleton from "./skeleton"; import RecommendationSkeleton from "./skeleton";
import { getRecommendationAnimeAction } from "../../actions/getRecommenationAnime";
const Recommendation = async () => { const Recommendation = async () => {
return ( return (
<div className="mt-12"> <div className="mt-12">
<h1 className="text-2xl text-neutral-100 font-semibold w-fit"> <div>
<h1 className="text-[26px] text-neutral-100 font-semibold w-fit tracking-tight">
Maybe You Like Maybe You Like
<div className="w-full h-0.5 bg-primary -mt-1.5" />
</h1> </h1>
</div>
<Suspense fallback={<RecommendationSkeleton />}> <Suspense fallback={<RecommendationSkeleton />}>
<RecommendationMain /> <RecommendationMain />
</Suspense> </Suspense>