diff --git a/src/components/Actors/Actors.jsx b/src/components/Actors/Actors.jsx index e69de29..b002ef3 100644 --- a/src/components/Actors/Actors.jsx +++ b/src/components/Actors/Actors.jsx @@ -0,0 +1,65 @@ +import { useState } from 'react'; +import { Box, Button, CircularProgress, Grid, Typography } from '@mui/material'; +import { useNavigate, useParams } from 'react-router-dom'; +import { ArrowBack } from '@mui/icons-material'; + +import useStyles from './styles'; +import { useGetActorQuery, useGetMoviesByActorIdQuery } from '../../services/TMDB'; +import { MovieList, Pagination } from '../index'; + +function Actors() { + const classes = useStyles(); + const [page, setPage] = useState(1); + const navigate = useNavigate(); + const { id } = useParams(); + const { data, isFetching, error } = useGetActorQuery(id); + const { data: movies } = useGetMoviesByActorIdQuery({ id, page }); + + if (isFetching) { + return ( + + + + ); + } + + if (error) { + return ( + + + + ); + } + + return ( + <> + + + {data.name} + + + {data?.name} + Born: {new Date(data?.birthday).toDateString()} + {data?.biography || 'Sorry, no biography yet...'} + + + + + + + + Movies + {movies && } + + + + ); +} + +export default Actors; \ No newline at end of file