Compare commits
4 Commits
72f13c7c2e
...
6f2588250c
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f2588250c | |||
| 7a4c92526e | |||
| 73ed6ce3b8 | |||
| 4e5d509e99 |
23
features/home/sections/Hero/components/AddToList.tsx
Normal file
23
features/home/sections/Hero/components/AddToList.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import { useAuth } from "@/shared/contexts/AuthContext";
|
||||
import { Button } from "@/shared/libs/shadcn/ui/button";
|
||||
import { Icon } from "@iconify/react";
|
||||
|
||||
const AddToList = ({ mediaId }: { mediaId: string }) => {
|
||||
const { session } = useAuth();
|
||||
|
||||
return (
|
||||
<div>
|
||||
{session?.user && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="h-full flex gap-1 px-4 rounded-xl border border-neutral-400/10 bg-neutral-950/20 hover:bg-neutral-950/40 backdrop-blur-lg text-neutral-200"
|
||||
>
|
||||
<Icon icon="boxicons:bookmark" className="size-5.5" />
|
||||
<span>Add to List</span>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddToList;
|
||||
@ -2,10 +2,11 @@
|
||||
import "swiper/css";
|
||||
import { Badge } from "@/shared/libs/shadcn/ui/badge";
|
||||
import { Button } from "@/shared/libs/shadcn/ui/button";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Autoplay, Navigation, Pagination } from "swiper/modules";
|
||||
import { Swiper, SwiperSlide } from "swiper/react";
|
||||
import { Icon } from "@iconify/react";
|
||||
import Link from "next/link";
|
||||
import AddToList from "./AddToList";
|
||||
|
||||
export interface HeroSwiperProps {
|
||||
data: {
|
||||
@ -22,7 +23,6 @@ export interface HeroSwiperProps {
|
||||
}
|
||||
|
||||
const HeroSwiper = (props: HeroSwiperProps) => {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<div className="h-full rounded-lg overflow-hidden">
|
||||
<Swiper
|
||||
@ -34,8 +34,8 @@ const HeroSwiper = (props: HeroSwiperProps) => {
|
||||
autoplay={{ delay: 5000, disableOnInteraction: false }}
|
||||
modules={[Autoplay, Pagination, Navigation]}
|
||||
>
|
||||
{props.data.map((slide) => (
|
||||
<SwiperSlide key={slide.id} className="relative overflow-hidden">
|
||||
{props.data.map((slide, index) => (
|
||||
<SwiperSlide key={index} className="relative overflow-hidden">
|
||||
<img
|
||||
src={slide.imageUrl}
|
||||
alt={slide.title}
|
||||
@ -53,32 +53,38 @@ const HeroSwiper = (props: HeroSwiperProps) => {
|
||||
</h1>
|
||||
<div className="mt-4 flex gap-1.5">
|
||||
{slide.genres.map((genre) => (
|
||||
<Badge
|
||||
className="bg-neutral-200 text-neutral-800"
|
||||
key={genre.slug}
|
||||
>
|
||||
{genre.name}
|
||||
</Badge>
|
||||
<Link href={`/genres/${genre.slug}`} key={genre.slug}>
|
||||
<Badge className="bg-neutral-100/60 backdrop-blur-lg text-neutral-800">
|
||||
{genre.name}
|
||||
</Badge>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<p className="mt-4 font-medium text-base max-w-[40vw] line-clamp-6">
|
||||
{slide.synopsis}
|
||||
</p>
|
||||
<Button
|
||||
size="lg"
|
||||
onClick={() => router.push(`/media/${slide.slug}`)}
|
||||
className="mt-6 h-12 rounded-xl flex gap-2 px-4 hover:bg-neutral-950 group"
|
||||
>
|
||||
<div className="bg-neutral-950 p-2 rounded-full group-hover:bg-primary">
|
||||
<Icon
|
||||
icon="solar:play-bold"
|
||||
className="text-primary group-hover:text-neutral-950"
|
||||
/>
|
||||
</div>
|
||||
<span className="font-semibold text-neutral-950 group-hover:text-primary">
|
||||
Watch Now
|
||||
</span>
|
||||
</Button>
|
||||
<div className="flex gap-2 mt-6 h-12">
|
||||
<Link
|
||||
href={`/media/${slide.slug}`}
|
||||
className="w-fit h-full rounded-xl overflow-hidden"
|
||||
>
|
||||
<Button
|
||||
size="lg"
|
||||
className="h-full flex gap-2 px-4 hover:bg-neutral-950 group"
|
||||
>
|
||||
<div className="bg-neutral-950 p-2 rounded-full group-hover:bg-primary">
|
||||
<Icon
|
||||
icon="solar:play-bold"
|
||||
className="text-primary group-hover:text-neutral-950"
|
||||
/>
|
||||
</div>
|
||||
<span className="font-semibold text-neutral-950 group-hover:text-primary">
|
||||
Watch Now
|
||||
</span>
|
||||
</Button>
|
||||
</Link>
|
||||
<AddToList mediaId={slide.id} />
|
||||
</div>
|
||||
</div>
|
||||
</SwiperSlide>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user