Skip to content

Commit

Permalink
Merge pull request #20 from SSUMC-7th/jett/#6
Browse files Browse the repository at this point in the history
[week5/mission] 로그인 / 회원가입 페이지 제작
  • Loading branch information
S-Gihun authored Oct 28, 2024
2 parents 1e4494b + e68c983 commit be4f4ce
Show file tree
Hide file tree
Showing 82 changed files with 7,569 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mission/missionweek5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# apiKey
.env
8 changes: 8 additions & 0 deletions mission/missionweek5/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
38 changes: 38 additions & 0 deletions mission/missionweek5/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
13 changes: 13 additions & 0 deletions mission/missionweek5/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions mission/missionweek5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "week3",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"axios": "^1.7.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.26.2",
"styled-components": "^6.1.13",
"styled-reset": "^4.5.2",
"yup": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"vite": "^5.4.8"
}
}
1 change: 1 addition & 0 deletions mission/missionweek5/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mission/missionweek5/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

79 changes: 79 additions & 0 deletions mission/missionweek5/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import "./App.css";

import { createBrowserRouter, RouterProvider } from "react-router-dom";

import HomePage from "./pages/home.jsx";
import NotFound from "./pages/not-found.jsx";
import MoviesPage from "./pages/movies.jsx";
import RootLayout from "./layout/root-layout.jsx";
import LoginPage from "./pages/login.jsx";
import SignupPage from "./pages/signup.jsx";
import SearchPage from "./pages/search.jsx";
import CategorPage from "./pages/categories.jsx";
import PopularPage from "./pages/popular.jsx";
import TopRatedPage from "./pages/topRated.jsx";
import NowPlayingPage from "./pages/nowPlaying.jsx";
import UpComingPage from "./pages/upComing.jsx";
import MovieDetailPage from "./pages/movieDetail.jsx";

const router = createBrowserRouter([
{
path: "/",
element: <RootLayout />,
errorElement: <NotFound />,
// 1. Navbar 밑에 path에 해당하는 element를 보여주고 싶으면 아래와 같이 children을 활용
children: [
{
// 2. index: true는 위의 path: '/' 즉, 홈 경로를 의미한다.
index: true,
element: <HomePage />,
},
{
// 3. 부모의 path가 '/'이니, /를 붙이지 않아도 /movies랑 동일하게 동작한다.
// /:을 활용해서, 동적으로 바뀌는 부분의 이름을 정의해줍시다.
path: "movies",
element: <CategorPage />,
},
{
// 3. 부모의 path가 '/'이니, /를 붙이지 않아도 /movies랑 동일하게 동작한다.
// /:을 활용해서, 동적으로 바뀌는 부분의 이름을 정의해줍시다.
path: "movies/:movieId",
element: <MovieDetailPage />,
},
{
path: "popular",
element: <PopularPage />,
},
{
path: "top_rated",
element: <TopRatedPage />,
},
{
path: "now_playing",
element: <NowPlayingPage />,
},
{
path: "upcoming",
element: <UpComingPage />,
},
{
path: "login",
element: <LoginPage />,
},
{
path: "signup",
element: <SignupPage />,
},
{
path: "search",
element: <SearchPage />,
},
],
},
]);

function App() {
return <RouterProvider router={router} />;
}

export default App;
10 changes: 10 additions & 0 deletions mission/missionweek5/src/apis/axios-instance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import axios from "axios";

const axiosInstance = axios.create({
headers: {
Authorization: `Bearer ${import.meta.env.VITE_APP_API_KEY}`,
},
baseURL: import.meta.env.VITE_MOVIE_API_URL,
});

export default axiosInstance;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions mission/missionweek5/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions mission/missionweek5/src/components/MovieDetailInfo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from "react";
import styled from "styled-components";

const MovieDetailInfo = ({ movie, detailMovies }) => {
return (
<BackGroundContainer>
<BackIMG src={`https://image.tmdb.org/t/p/w500${movie.backdrop_path}`} />
<Shadow />
<DetailContainer>
<Title>{detailMovies.title}</Title>
<RatingYearContainer>
<Rating>평균: {detailMovies.vote_average}</Rating>
<Year>{detailMovies.release_date?.slice(0, 4)}</Year>
<RunTime>{detailMovies.runtime}</RunTime>
</RatingYearContainer>
<TagLine>{detailMovies.tagline}</TagLine>
<DetailText>{detailMovies.overview}</DetailText>
</DetailContainer>
</BackGroundContainer>
);
};

export default MovieDetailInfo;

// 스타일링
const BackGroundContainer = styled.div`
position: relative;
`;

const Shadow = styled.div`
position: absolute;
background: linear-gradient(
to right,
rgba(0, 0, 0, 0.8),
rgba(255, 255, 255, 0.1)
);
width: 100%;
height: 50vh;
top: 0px;
left: 0px;
border-radius: 20px;
margin-bottom: 20px;
z-index: 2;
`;

const BackIMG = styled.img`
width: 100%;
height: 50vh;
object-fit: cover;
border-radius: 20px;
margin-bottom: 20px;
z-index: 1;
`;

const DetailContainer = styled.div`
position: absolute;
text-align: left;
color: white;
top: 15px;
left: 20px;
max-width: 600px;
z-index: 3;
`;

const Title = styled.h1`
color: white;
font-size: 32px;
font-weight: bold;
margin-bottom: 15px;
`;

const RatingYearContainer = styled.div`
display: flex;
flex-direction: column;
`;

const Rating = styled.span`
font-size: 24px;
color: #f39c12;
font-weight: bold;
margin-right: 20px;
`;

const Year = styled.span`
font-size: 15px;
color: white;
font-weight: bold;
`;

const RunTime = styled.span`
font-size: 15px;
color: white;
font-weight: bold;
`;

const TagLine = styled.h1`
color: white;
font-size: 32px;
font-weight: bold;
margin-bottom: 15px;
font-style: italic;
`;

const DetailText = styled.div`
margin-bottom: 15px;
font-size: 14px;
line-height: 1.6;
`;
58 changes: 58 additions & 0 deletions mission/missionweek5/src/components/MovieDetailPeople.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import styled from "styled-components";

const MovieDetailPeople = ({ people }) => {
return (
<>
<Subh4>감독/출현</Subh4>
<PeoplesContainer>
{people.slice(0, 20).map((person) => (
<PeopleContainer key={person.id}>
<IMG
src={`https://image.tmdb.org/t/p/w200${person.profile_path}`}
/>
<Name>{person.name}</Name>
</PeopleContainer>
))}
</PeoplesContainer>
</>
);
};

export default MovieDetailPeople;

// 스타일링
const Subh4 = styled.h4`
color: white;
margin: 10px 0;
font-size: 18px;
font-weight: 500;
`;

const PeoplesContainer = styled.div`
display: grid;
grid-template-columns: repeat(10, 1fr);
grid-template-rows: auto;
gap: 20px;
justify-content: center;
`;

const PeopleContainer = styled.div`
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`;

const IMG = styled.img`
width: 100px;
height: 100px;
border-radius: 50%;
object-fit: cover;
border: 3px solid white;
`;

const Name = styled.h4`
color: white;
`;
Loading

0 comments on commit be4f4ce

Please sign in to comment.