diff --git a/react/netflix-app/src/components/Row.js b/react/netflix-app/src/components/Row.js index b7064963..4bba40c5 100644 --- a/react/netflix-app/src/components/Row.js +++ b/react/netflix-app/src/components/Row.js @@ -1,9 +1,12 @@ import axios from "../api/axios"; import React, { useEffect, useState } from "react"; import "./Row.css"; +import MovieModal from "./modal"; const Row = ({ title, id, fetchUrl, isLargeRow }) => { const [movies, setMovies] = useState([]); + const [modalOpen, setModalOpen] = useState(false); + const [movieSelected, setMovieSelected] = useState({}); useEffect(() => { fetchMovieData(); @@ -15,6 +18,11 @@ const Row = ({ title, id, fetchUrl, isLargeRow }) => { setMovies(request.data.results); }; + const handleClick = (movie) => { + setModalOpen(true); + setMovieSelected(movie); + }; + return (

{title}

@@ -37,6 +45,7 @@ const Row = ({ title, id, fetchUrl, isLargeRow }) => { isLargeRow ? movie.poster_path : movie.backdrop_path }`} alt={movie.name} + onClick={() => handleClick(movie)} /> ))} @@ -50,6 +59,10 @@ const Row = ({ title, id, fetchUrl, isLargeRow }) => { {">"} + + {modalOpen && ( + + )}
); }; diff --git a/react/netflix-app/src/components/modal/MovieModal.css b/react/netflix-app/src/components/modal/MovieModal.css new file mode 100644 index 00000000..f59225ce --- /dev/null +++ b/react/netflix-app/src/components/modal/MovieModal.css @@ -0,0 +1,98 @@ +.modal { + position: relative; + max-width: 800px; + box-shadow: 0px 3px 5px -1px rgba(0, 0, 0, 0.2), + 0px 5px 8px 0px rgba(0, 0, 0, 0.14), 0px 1px 14px 0px rgba(0, 0, 0, 0.12); + background: #111; + overflow: hidden; + border-radius: 8px; + transition: all 400ms ease-in-out 2s; + animation: fadeIn 400ms; +} +.modal__poster-img { + width: 100%; + height: auto; +} +.modal__content { + padding: 40px; + color: white; +} +.modal__title { + padding: 0; + font-size: 40px; + margin: 16px 0; +} +.modal__details { + font-weight: 600; + font-size: 18px; +} +.modal__overview { + font-size: 20px; + line-height: 1.5; +} +.modal__user-perc { + color: #46d369; +} +.modal::-webkit-scrollbar { + display: none; + visibility: hidden; +} + +/* Hide scrollbar for IE, Edge and Firefox */ +.modal { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ +} +.wrapper-modal { + position: fixed; + inset: 0px; + background-color: rgb(0 0 0 / 71%); + -webkit-tap-highlight-color: transparent; + display: flex; + justify-content: center; +} +.presentation { + z-index: 1200; + position: absolute; +} +.modal-close { + position: absolute; + right: 20px; + top: 20px; + cursor: pointer; + z-index: 1000; + color: white; +} +@media screen and (max-height: 768px) { + .wrapper-modal { + align-items: unset; + padding-top: 2rem; + } + .modal { + overflow-y: scroll; + } +} +@media screen and (max-width: 768px) { + .modal__overview { + font-size: 16px; + } + .modal__details { + font-size: 16px; + } + .wrapper-modal { + padding: 0; + } + .modal { + overflow-y: scroll !important; + } +} +@keyframes fadeIn { + from { + opacity: 0; + transform: scale(0.5); + } + to { + opacity: 1; + transform: scale(1); + } +} diff --git a/react/netflix-app/src/components/modal/index.js b/react/netflix-app/src/components/modal/index.js new file mode 100644 index 00000000..bf827512 --- /dev/null +++ b/react/netflix-app/src/components/modal/index.js @@ -0,0 +1,45 @@ +import React from "react"; +import "./MovieModal.css"; + +const MovieModal = ({ + backdrop_path, + title, + overview, + name, + release_date, + first_air_date, + vote_averate, + setModalOpen, +}) => { + return ( +
+
+
+ setModalOpen(false)}> + X + + + modal__poster-img + +
+

+ 100% for you + + {release_date ? release_date : first_air_date} +

+ +

{title ? title : name}

+

평점 : {vote_averate}

+

{overview}

+
+
+
+
+ ); +}; + +export default MovieModal;