From 3f5ebc528cf7c4e593b8068afd8f739d73d7cb04 Mon Sep 17 00:00:00 2001 From: iqbalpa Date: Wed, 10 Jul 2024 21:46:24 +0700 Subject: [PATCH] feat(detail): create back button --- src/modules/detailMovie/detailMovie.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/modules/detailMovie/detailMovie.tsx b/src/modules/detailMovie/detailMovie.tsx index 281b4fc..b1ddf37 100644 --- a/src/modules/detailMovie/detailMovie.tsx +++ b/src/modules/detailMovie/detailMovie.tsx @@ -1,14 +1,19 @@ +'use client'; + import api from '@/api/api'; import { DetailMovie } from '@/constant/detailMovie'; import React, { useEffect, useState } from 'react'; import Image from 'next/image'; import { Skeleton } from '@/components/ui/skeleton'; +import { CircleArrowLeft } from 'lucide-react'; +import { useRouter } from 'next/navigation'; interface IDetailMovieModule { id: string; } const DetailMovieModule: React.FC = ({ id }) => { + const router = useRouter(); const [movie, setMovie] = useState(); const [isLoading, setIsLoading] = useState(true); @@ -25,9 +30,18 @@ const DetailMovieModule: React.FC = ({ id }) => { fetchMovie(); }, [id]); + const handleBack = () => router.push('/'); + return (
+
{isLoading && ( @@ -57,7 +71,7 @@ const DetailMovieModule: React.FC = ({ id }) => {

{movie.title}

{movie.overview}

-
+
{movie.genres.map((genre, index) => (