diff --git a/mission/chapter03/mission01/.gitignore b/mission/chapter03/mission01/.gitignore index a547bf3..7ceb59f 100644 --- a/mission/chapter03/mission01/.gitignore +++ b/mission/chapter03/mission01/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +.env diff --git a/mission/chapter03/mission01/src/App.jsx b/mission/chapter03/mission01/src/App.jsx index 59b79b3..1251e2f 100644 --- a/mission/chapter03/mission01/src/App.jsx +++ b/mission/chapter03/mission01/src/App.jsx @@ -5,6 +5,7 @@ import CategoryPage from "./pages/categoryPage"; import SearchPage from "./pages/searchPage"; import LoginPage from "./pages/loginPage"; import SignupPage from "./pages/signupPage"; +import HomePage from "./pages/homePage"; const router = createBrowserRouter([ { @@ -12,7 +13,7 @@ const router = createBrowserRouter([ element: , children: [ { index:true, - element : + element : }, { path: 'search', @@ -30,6 +31,11 @@ const router = createBrowserRouter([ path: 'signup', element: } + , + { + path: 'movies/:category', + element: + } ] } ]) diff --git a/mission/chapter03/mission01/src/components/categoryCard/categoryCard.jsx b/mission/chapter03/mission01/src/components/categoryCard/categoryCard.jsx new file mode 100644 index 0000000..a36edf5 --- /dev/null +++ b/mission/chapter03/mission01/src/components/categoryCard/categoryCard.jsx @@ -0,0 +1,35 @@ +import styled from "styled-components"; + + +const CategoryCard = ({title})=>{ + return( + + {title} + + ) + +} + +export default CategoryCard; + +const CardDiv = styled.div` + width : 200px; + height : 100px; + background-color : white; + border-radius: 10px; + display : flex; + align-items : flex-end; + &:hover{ + transform: scale(1.05); + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); + } +` +const CardSpan = styled.span` + background-color: grey; + color: white; + opacity: 0.5; + border-radius: 5px; + margin :10px 10px 10px 10px; + padding : 0px 3px 3px 3px; + vertical-align : bottom; +` \ No newline at end of file diff --git a/mission/chapter03/mission01/src/components/moviePoster.css b/mission/chapter03/mission01/src/components/moviePoster/moviePoster.css similarity index 66% rename from mission/chapter03/mission01/src/components/moviePoster.css rename to mission/chapter03/mission01/src/components/moviePoster/moviePoster.css index 1e8f619..354bdc3 100644 --- a/mission/chapter03/mission01/src/components/moviePoster.css +++ b/mission/chapter03/mission01/src/components/moviePoster/moviePoster.css @@ -1,15 +1,23 @@ .movie_item{ display: flex; - height: 240px; + flex-direction: column; + height: 300px; width: 160px; position: relative; + overflow: hidden; + } + .movie_item span{ + font-size: 15px; + } + .movie_item p{ + font-size: 10px; + margin-top: 2px; } .poster_img{ width: 100%; - height: 100%; + height: 80%; object-fit: cover; border-radius: 10px; - } .poster_hover{ width: 100%; diff --git a/mission/chapter03/mission01/src/components/moviePoster.jsx b/mission/chapter03/mission01/src/components/moviePoster/moviePoster.jsx similarity index 71% rename from mission/chapter03/mission01/src/components/moviePoster.jsx rename to mission/chapter03/mission01/src/components/moviePoster/moviePoster.jsx index 6b175ad..1a01871 100644 --- a/mission/chapter03/mission01/src/components/moviePoster.jsx +++ b/mission/chapter03/mission01/src/components/moviePoster/moviePoster.jsx @@ -1,10 +1,12 @@ import "./moviePoster.css" const MoviePoster = (props)=>{ - const {poster_path} = props + const {poster_path, title, release_date} = props return (
+ {title} +

{release_date}

) diff --git a/mission/chapter03/mission01/src/components/navbar.jsx b/mission/chapter03/mission01/src/components/navbar.jsx deleted file mode 100644 index 7b49cea..0000000 --- a/mission/chapter03/mission01/src/components/navbar.jsx +++ /dev/null @@ -1,23 +0,0 @@ -import {Link} from "react-router-dom"; -import styled from "styled-components"; - -const Navbar = () => { - return ( - - YONGCHA -
- - -
-
- ); -}; - -export default Navbar; - -const NavContainer = styled.div` - display: flex; - justify-content: space-between; - width: 100%; - background-color: rgb(42, 37, 37); -` \ No newline at end of file diff --git a/mission/chapter03/mission01/src/components/navbar/navbar.jsx b/mission/chapter03/mission01/src/components/navbar/navbar.jsx new file mode 100644 index 0000000..e86d1e7 --- /dev/null +++ b/mission/chapter03/mission01/src/components/navbar/navbar.jsx @@ -0,0 +1,41 @@ +import {Link} from "react-router-dom"; +import styled from "styled-components"; + +const Navbar = () => { + return ( + + YONGCHA +
+ 로그인 + 회원가입 +
+
+ ); +}; + +export default Navbar; + +const NavContainer = styled.div` + display: flex; + justify-content: space-between; + width: 100%; + background-color: #1b1b1b; + align-items: center; +` +const StyledButton = styled.button` + background-color: ${props => props.color}; + border: none; + color: white; + padding: 10px 20px; + border-radius: 5px; + margin-left: 10px; + cursor: pointer; + font-size: 16px; + &:hover { + background-color: #ff007c; + } +` +const Logo = styled.h2` + color: #ff007c; + padding-left : 20px; +` \ No newline at end of file diff --git a/mission/chapter03/mission01/src/components/sidebar.jsx b/mission/chapter03/mission01/src/components/sidebar.jsx deleted file mode 100644 index 7a79b0e..0000000 --- a/mission/chapter03/mission01/src/components/sidebar.jsx +++ /dev/null @@ -1,20 +0,0 @@ -import styled from "styled-components"; -import { Link } from "react-router-dom"; -const SideBar = () => { - return ( - - 찾기 - 영화 - - ); -}; - -export default SideBar; - -const SideBarContainer = styled.div` - dispaly: flex; - width; 200px; - height: 100vh; - background-color: rgb(42, 37, 37); - -` diff --git a/mission/chapter03/mission01/src/components/sidebar/icon/movie.png b/mission/chapter03/mission01/src/components/sidebar/icon/movie.png new file mode 100644 index 0000000..862711e Binary files /dev/null and b/mission/chapter03/mission01/src/components/sidebar/icon/movie.png differ diff --git a/mission/chapter03/mission01/src/components/sidebar/icon/search.png b/mission/chapter03/mission01/src/components/sidebar/icon/search.png new file mode 100644 index 0000000..6bc0e5e Binary files /dev/null and b/mission/chapter03/mission01/src/components/sidebar/icon/search.png differ diff --git a/mission/chapter03/mission01/src/components/sidebar/sidebar.css b/mission/chapter03/mission01/src/components/sidebar/sidebar.css new file mode 100644 index 0000000..b390b4d --- /dev/null +++ b/mission/chapter03/mission01/src/components/sidebar/sidebar.css @@ -0,0 +1,17 @@ + ul li { + color: white; + text-decoration: none; + font-size: 18px; + display: block; + padding-top: 10px; + padding-bottom: 10px; + transition: background-color 0.3s; +} +ul{ + padding-left: 20px; + padding-right: 0px; +} +ul li:hover{ + background-color: #333; + border-radius: 5px; +} \ No newline at end of file diff --git a/mission/chapter03/mission01/src/components/sidebar/sidebar.jsx b/mission/chapter03/mission01/src/components/sidebar/sidebar.jsx new file mode 100644 index 0000000..f1f4b1b --- /dev/null +++ b/mission/chapter03/mission01/src/components/sidebar/sidebar.jsx @@ -0,0 +1,25 @@ +import styled from "styled-components"; +import { Link } from "react-router-dom"; +import searchIcon from "./icon/search.png" +import movieIcon from "./icon/movie.png" +import "./sidebar.css" +const SideBar = () => { + return ( + +
    +
  • 찾기
  • +
  • 영화
  • +
+
+ ); +}; + +export default SideBar; + +const SideBarContainer = styled.div` + dispaly: flex; + height: 100vh; + background-color: #1b1b1b; + width: 15%; + +` diff --git a/mission/chapter03/mission01/src/layout/root-layout.jsx b/mission/chapter03/mission01/src/layout/root-layout.jsx index 117a4de..5a923ca 100644 --- a/mission/chapter03/mission01/src/layout/root-layout.jsx +++ b/mission/chapter03/mission01/src/layout/root-layout.jsx @@ -1,6 +1,6 @@ import {Outlet} from "react-router-dom"; -import Navbar from "../components/navbar"; -import SideBar from "../components/sidebar"; +import Navbar from "../components/navbar/navbar"; +import SideBar from "../components/sidebar/sidebar"; import styled from "styled-components"; const RootLayout = () => { @@ -22,4 +22,6 @@ const BoxLayout = styled.div` display: flex; flex-direction: row; width: 100vw; + background-color: #111; + color: white; ` \ No newline at end of file diff --git a/mission/chapter03/mission01/src/pages/categoryPage.jsx b/mission/chapter03/mission01/src/pages/categoryPage.jsx index 2e84cbe..0e967a0 100644 --- a/mission/chapter03/mission01/src/pages/categoryPage.jsx +++ b/mission/chapter03/mission01/src/pages/categoryPage.jsx @@ -1,7 +1,37 @@ +import { Link } from "react-router-dom"; +import CategoryCard from "../components/categoryCard/categoryCard"; +import styled from "styled-components"; + +const categoryList = [ + { title : "현재 상영 중인", value : "now-playing"}, + { title : "인기 있는", value : "popular"}, + { title : "높은 평가를 받은", value : "top-rated"}, + { title : "개봉 예정중인", value : "up-coming"} + +] + const CategoryPage = ()=>{ return( -

카테고리

+ +

카테고리

+ + {categoryList.map((category)=>( + + ))} + +
) } -export default CategoryPage; \ No newline at end of file +export default CategoryPage; + +const CategoryContainer = styled.div` + display: flex; + flex-direction: column; + padding-left: 15px; +` +const CateListBox = styled.div` + display: flex; + flex-direction: row; + gap: 10px; +` \ No newline at end of file diff --git a/mission/chapter03/mission01/src/pages/homePage.jsx b/mission/chapter03/mission01/src/pages/homePage.jsx new file mode 100644 index 0000000..1a177b9 --- /dev/null +++ b/mission/chapter03/mission01/src/pages/homePage.jsx @@ -0,0 +1,7 @@ +const HomePage = ()=>{ + return( +

홈 페이지

+ ) +} + +export default HomePage; \ No newline at end of file diff --git a/mission/chapter03/mission01/src/pages/loginPage.jsx b/mission/chapter03/mission01/src/pages/loginPage.jsx index e87cc8b..27d6f55 100644 --- a/mission/chapter03/mission01/src/pages/loginPage.jsx +++ b/mission/chapter03/mission01/src/pages/loginPage.jsx @@ -1,6 +1,6 @@ const LoginPage = ()=>{ return( -

로그인 페이지

+

로그인 페이지

) } diff --git a/mission/chapter03/mission01/src/pages/moviesPage.jsx b/mission/chapter03/mission01/src/pages/moviesPage.jsx index b774bcc..3572a6b 100644 --- a/mission/chapter03/mission01/src/pages/moviesPage.jsx +++ b/mission/chapter03/mission01/src/pages/moviesPage.jsx @@ -1,31 +1,40 @@ import { useState, useEffect } from 'react' -import MoviePoster from '../components/moviePoster.jsx'; +import MoviePoster from '../components/moviePoster/moviePoster.jsx'; import './moviesPages.css' import axios from "axios"; +import { useParams } from 'react-router-dom'; + +const APIurl={ + "now-playing" : 'https://api.themoviedb.org/3/movie/now_playing?language=kr-KR&page=1', + "popular" : 'https://api.themoviedb.org/3/movie/popular?language=kr-KR&page=1', + "top-rated" : 'https://api.themoviedb.org/3/movie/top_rated?language=kr-KR&page=1', + "up-coming" :'https://api.themoviedb.org/3/movie/upcoming?language=kr-KR&page=1' +} const MoviesPage = () => { const [movies, setMovies] = useState([]); - + const {category} = useParams(); useEffect(() => { const getMovies = async () => { - const movies = await axios.get(`https://api.themoviedb.org/3/movie/popular?language=en-US&page=1`, { + const movies = await axios.get(APIurl[category], { headers: { - Authorization: `Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI3Yzk1MjQ3ZGU3NDUxMzY0MjM0MmE2MTc4ODQzOWYzNiIsIm5iZiI6MTcyODQ3OTkwOS44MDczNjEsInN1YiI6IjY3MDY3YmFkNTk3YzEyNmYwN2RkYzRhYSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.56L6fv17OgkRqftv2BLlKCJiw3-4w9Ym_g_sFhPyP-E` + Authorization: `Bearer ${import.meta.env.VITE_TMDB_ACCESS_TOKEN}` } }) setMovies(movies); } getMovies() - }, []); + }, [category]); return ( <>
{movies.data?.results.map((movie) => ( - + ))} - {console.log(movies)}
) diff --git a/mission/chapter03/mission01/src/pages/moviesPages.css b/mission/chapter03/mission01/src/pages/moviesPages.css index 43f495c..f33b39d 100644 --- a/mission/chapter03/mission01/src/pages/moviesPages.css +++ b/mission/chapter03/mission01/src/pages/moviesPages.css @@ -2,7 +2,8 @@ display: flex; flex-wrap: wrap; width: 100%; - gap: 10px; - margin-left: 10px; - justify-content: center; + gap: 15px; + margin-left: 15px; + margin-top: 15px; + } \ No newline at end of file diff --git a/mission/chapter03/mission01/src/pages/searchPage.jsx b/mission/chapter03/mission01/src/pages/searchPage.jsx index ea9728e..e109dfc 100644 --- a/mission/chapter03/mission01/src/pages/searchPage.jsx +++ b/mission/chapter03/mission01/src/pages/searchPage.jsx @@ -1,6 +1,6 @@ const SearchPage = ()=>{ return( -

검색 페이지 야호~!

+

검색 페이지 야호~!

) } diff --git a/mission/chapter03/mission01/src/pages/signupPage.jsx b/mission/chapter03/mission01/src/pages/signupPage.jsx index 572bdde..1d8cd29 100644 --- a/mission/chapter03/mission01/src/pages/signupPage.jsx +++ b/mission/chapter03/mission01/src/pages/signupPage.jsx @@ -1,6 +1,6 @@ const SignupPage = ()=>{ return( -

회원가입 페이지

+

회원가입 페이지

) }