Skip to content

FEAT: todoList, movieList #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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?
38 changes: 38 additions & 0 deletions 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 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>
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "week3",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-router-dom": "^6.26.2",
"styled-components": "^6.1.13"
},
"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"
}
}
1 change: 1 addition & 0 deletions 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.
42 changes: 42 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}

.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
}
59 changes: 59 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// styled-components로 수정
// root-layout , navbar 최상단, sidebar와 outlet 가로축으로 배치
// navbar ; 로고만들기 로고클릭시 홈페이지 로 이동
// 로그인과 회원가입 버튼 ; hover시 색상이 달라지도록 로그인 버튼 클릭시 /login 페이지
// 회원가입 버튼시 /signup 페이지
// sidebar ; react-icons 라이브러리
// 찾기 버튼 클릭시 /search

import './App.css'

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

import HomePage from "./pages/home.jsx";
import NotFound from "./pages/not-found.jsx";
import View from "./components/view.jsx";
import RootLayout from "./layout/root-layout.jsx";
import LoginPage from './pages/login.jsx';
import SignPage from './pages/signup.jsx';
import SearchPage from './pages/search.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: 'view',
element: <View/>,

},
{
path: 'login',
element:<LoginPage/>
},
{
path: 'signup',
element:<SignPage/>
},
{
path: 'search',
element:<SearchPage/>
}
]
},

])

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

export default App
1 change: 1 addition & 0 deletions 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.
49 changes: 49 additions & 0 deletions src/components/navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// navbar.jsx
import {Link} from "react-router-dom";
import styled from "styled-components";

const LogoLink = styled(Link)`
color: #F349AA; /* 분홍색 적용 */
font-size: 24px;
font-weight: bold;
text-transform: uppercase;
text-decoration: none;

&:hover {
color: #D26AAF; /* hover 시 색상 변화 */
}
`;
const StyledNav = styled.nav`
width: 100%;
height: 90px;
position: fixed;
top: 0 ;
left: 0 ;
background-color: black ;
display: flex ;
justify-content: space-between;
`;
const Logo = styled.div`
color: red ;

`;
const ButtonLink = styled(Link)`
color: white;
`;


const Navbar = () => {
return (
<StyledNav>
<Logo>
<LogoLink to={`/`}>YONGCHA</LogoLink>
</Logo>
<div>
<ButtonLink to={'/login'}>로그인</ButtonLink>
<ButtonLink to={'/signup'}>회원가입</ButtonLink>
</div>
</StyledNav>
);
};

export default Navbar;
38 changes: 38 additions & 0 deletions src/components/sidebar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// sidebar.jsx
import {Link} from "react-router-dom";
import { IoSearchSharp } from "react-icons/io5";
import { BiSolidCameraMovie } from "react-icons/bi";
import styled from 'styled-components';



const Sidebar = () => {
return (
<StyledSidebar>
<IoSearchSharp />
<ButtonLink to='/search'>찾기</ButtonLink>
<div></div>
<BiSolidCameraMovie />
<ButtonLink to='/view'>영화</ButtonLink>
</StyledSidebar>
);
}

export default Sidebar;

const StyledSidebar = styled.aside`

width : 200px;
height: 100%;
background-color: black;
position : fixed;
left : 0;
`;

const ButtonLink = styled(Link)`
padding: 10px 20px;
margin-top:100px;
color: white;
text-align: center;

`;
57 changes: 57 additions & 0 deletions src/components/view.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { MOVIES } from "../moks/movies";
//import "../styles/view.css";
import styled from "styled-components";


const IMAGE_BASE_URL = "https://image.tmdb.org/t/p/w500";

const View = () => {
return (
<StyleDivComponent>
{MOVIES.results.map((movie) => (
<MovieDivComponent key={movie.id}>
<StyleImage
src={`${IMAGE_BASE_URL}${movie.poster_path}`}
alt={movie.title}
/>
<OverlayDivComponent></OverlayDivComponent>
<div>{movie.title}</div>
<div>{movie.release_date}</div>
</MovieDivComponent>
))}
</StyleDivComponent>
);
};
//div 태그 만들고 싶을때
const StyleDivComponent = styled.div`
display: flex;
flex-wrap: wrap;
justify-content: center;
`;
const MovieDivComponent = styled.div`
position: relative;
width: 160px;
margin: 10px;
`;
const OverlayDivComponent = styled.div`
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
opacity: 0;
border-radius: 10px;
transition: opacity 0.3s ease;

${MovieDivComponent}:hover & {
opacity: 1;
}
`;
const StyleImage = styled.img`
width: 100%;
height: 100%;
border-radius: 10px;
`

export default View;
Loading