Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions 밍붕-김민서/4주차+5주차 미션 밍붕/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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
.env
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions 밍붕-김민서/4주차+5주차 미션 밍붕/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 밍붕-김민서/4주차+5주차 미션 밍붕/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 밍붕-김민서/4주차+5주차 미션 밍붕/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>
38 changes: 38 additions & 0 deletions 밍붕-김민서/4주차+5주차 미션 밍붕/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "3-----",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"axios": "^1.7.7",
"bootstrap": "^5.3.3",
"react": "^18.3.1",
"react-bootstrap": "^2.10.5",
"react-dom": "^18.3.1",
"react-hook-form": "^7.53.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.26.2",
"styled-component": "^2.8.0",
"styled-components": "^6.1.13",
"yup": "^1.4.0"
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.11.1",
"eslint-plugin-react": "^7.37.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.12",
"globals": "^15.9.0",
"vite": "^5.4.8"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions 밍붕-김민서/4주차+5주차 미션 밍붕/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import HomePage from './pages/home.jsx';
import NotFound from './pages/not-found.jsx';
import Movies from './pages/movies.jsx';
import RootLayout from './layout/root-layout.jsx';
import Login from './pages/login.jsx';
import SignUp from './pages/signup.jsx';
import Search from './pages/search.jsx';
import Category from './pages/category';
import { createGlobalStyle } from 'styled-components';
import Detail from './pages/detail.jsx';

const GlobalStyle = createGlobalStyle`
* {
margin: 0;
padding: 0;
box-sizing: border-box; /* 박스 모델 설정 */
}
`;

const router = createBrowserRouter([
{
path: '/',
element: <RootLayout />,
errorElement: <NotFound />,
children: [
{
// 2. index: true는 위의 path: '/' 즉, 홈 경로를 의미한다.
index: true,
element: <Movies />,
},
{
path: 'movies/:movieId',
element : <Detail/>,
},
{
path: 'login',
element: <Login />,
},
{
path: 'signup',
element: <SignUp />,
},

{
path: 'search',
element: <Search />,
},
{
path: 'category',
element: <Category />,
},
{
path: 'category/:id',
element: <Movies></Movies>,
},
],
},
]);

function App() {
return (
<>
<GlobalStyle /> {/* 전역 스타일 적용 */}
<RouterProvider router={router} />
</>
);
}

export default App;
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_TMDB_TOKEN}`,
},
baseURL: import.meta.env.VITE_MOVIE_API_URL,
});

export { axiosInstance };
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { default as cbr } from './cbr500r.png';
export { default as ninja } from './ninja.png';
export { default as r1 } from './r1.png';
export { default as rocket } from './rocket.png';
export { default as watcha } from './watcha.png';
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import styled from 'styled-components';

const Button = (props) => {
return (
<ButtonStyle color={props.color} width={props.width} height={props.height}>
{props.children}
</ButtonStyle>
);
};

export default Button;

const ButtonStyle = styled.button`
width: ${(props) => props.width || '60px'};
height: ${(props) => props.height || 'auto'};
color: white;
background-color: ${(props) => props.color || 'white'};
border-radius: 10px;
border: solid black 1px;
&:hover {
filter: brightness(1.2);
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import styled from 'styled-components';

const Input = ({ label, error, ...props }) => {
return (
<InputContainer>
{label && <Label>{label}</Label>}
<StyledInput hasError={!!error} {...props} />
{error && <ErrorMessage>{error}</ErrorMessage>}
</InputContainer>
);
};

export default Input;

const InputContainer = styled.div`
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
`;

const Label = styled.label`
font-size: 14px;
color: #333;
`;

const StyledInput = styled.input`
width: 100%;
padding: 12px 16px;
border: 2px solid ${(props) => (props.hasError ? '#ff4d4f' : '#e1e1e1')};
border-radius: 8px;
font-size: 16px;
outline: none;
transition: all 0.2s ease-in-out;

&:focus {
border-color: ${(props) => (props.hasError ? '#ff4d4f' : '#4096ff')};
box-shadow: 0 0 0 2px ${(props) => (props.hasError ? 'rgba(255, 77, 79, 0.2)' : 'rgba(64, 150, 255, 0.2)')};
}

&::placeholder {
color: #999;
}
`;

const ErrorMessage = styled.p`
color: #ff4d4f;
font-size: 14px;
margin: 0;
min-height: 20px;
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// navbar.jsx
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import logo from '../assets/watcha.png';
import Button from './button';
const Navbar = () => {
return (
<NavStyle>
<Link to={'/'}>
<MainLogo src={logo} alt="로고" />
</Link>
<ButtonContainer>
<Link to={'/login'}>
<Button height={`40px`} color={'black'}>로그인</Button>
</Link>
<Link to={`/signup`}>
<Button color="#EF007E" height={`40px`}>
회원가입
</Button>
</Link>
</ButtonContainer>
</NavStyle>
);
};

export default Navbar;

const NavStyle = styled.nav`
display: grid;
position: sticky;
top : 0;
padding-left: 20px;
padding-right: 20px;
grid-template-areas: 'logo ㆍ ㆍ ㆍ ㆍ ㆍ ㆍ ㆍ ㆍ button';
grid-template-columns: repeat(10, 1fr);
justify-content: space-between;
grid-area: nav;
width: 100%;
height: 100%;
background-color: #1b1b1b;
z-index: 100;
`;

const MainLogo = styled.img`
grid-area: logo;
width: 200px;
height: auto;
`;

const ButtonContainer = styled.div`
grid-area: button;
display: flex;
flex-wrap: nowrap;
justify-content: space-evenly;
height: 100%;
align-items: center;
`;
Loading