-
Notifications
You must be signed in to change notification settings - Fork 16
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
[6주차] ForgetMeNot 미션 제출합니다. #12
base: master
Are you sure you want to change the base?
Changes from all commits
6cec7e8
240f742
6ab37a5
c921076
010591d
903c49a
1c4d617
9a6ea9a
530be51
4ae25d3
8a26c58
2c8cb9b
90e4fc5
c31c476
70becae
d4d0251
4ba5335
aeec980
2b1e0a9
8ae3560
e0830e1
88ae9e3
b6bc589
6e69797
355fa26
87fc34e
e41ddb2
55227de
7cc63a5
9196de5
e7f9557
14c2bd2
7644abd
bb9c0f7
158e4a1
6ed3655
ac163a8
6ad82f8
bdd7edb
a2b0fb3
12f05dd
471e5fc
0055d72
4f84a71
d722164
434f1db
75d5d02
acc385f
390ea6e
75d0321
38b13d2
4cdb9d5
3ce4ccc
1465197
fd61a58
d5ddeeb
b958cf6
e1c4601
00317a1
afe699f
921b60c
ebc0a5a
e821fed
b96b93c
9cfd602
3100f69
003f91a
b070641
9d2e7f4
13ed30a
635c68b
4d99757
d1610a1
74ade68
d5015f5
92cd03c
926c064
da9e1ad
02e5f4f
ec726dd
9519be6
59edb85
a4a8576
845a29e
1edea0b
d04bf9a
7cb424a
63b988c
2cd79e0
a7921c3
51ba36e
4d79c6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [["styled-components", { "ssr": true }]] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. | ||
|
||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`. | ||
|
||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const api = "https://api.themoviedb.org/3"; | ||
export const apiKey = 'dfc5ce9cefd9cafb067049fffa0be4e3'; | ||
export const imgPath = "https://image.tmdb.org/t/p/w500"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { useState } from "react"; | ||
|
||
function useInput(initialText: string) { | ||
const [text, setText] = useState(initialText); | ||
|
||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>): void => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changeEvent 타입은 처음 보는 것 같아요! 배워갑니다 ㅎㅎ |
||
setText(e.target.value); | ||
}; | ||
|
||
const resetText = (): void => { | ||
setText(""); | ||
}; | ||
|
||
return { text, handleChange, resetText }; | ||
} | ||
|
||
export default useInput; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import styled from "styled-components"; | ||
import Link from "next/link"; | ||
import Image from "next/image"; | ||
import { useRouter } from "next/router"; | ||
|
||
const naviList = [ | ||
{ id: 0, src: "navi1", text: "Home", link: "/home" }, | ||
{ id: 1, src: "navi2", text: "Search", link: "/search" }, | ||
{ id: 2, src: "navi3", text: "Coming Soon", link: "" }, | ||
{ id: 3, src: "navi4", text: "Downloads", link: "" }, | ||
{ id: 4, src: "navi5", text: "More", link: "" }, | ||
]; | ||
|
||
const Navigator = () => { | ||
const pathName = useRouter(); | ||
|
||
return ( | ||
<Container> | ||
<> | ||
{naviList.map((item, idx) => ( | ||
<NaviContainer> | ||
<Link href={item.link} key={idx}> | ||
{pathName.pathname === item.link ? ( | ||
<> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 빈 태그를 이용하신 이유가 따로 있으실까요 ?! |
||
<Image | ||
src={`/img/navigator/select_${item.src}.svg`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 선택여부에 따라 아이콘 색이 바뀌는걸 이렇게 표현하는 방법도 있었군요 ! |
||
alt="navi" | ||
width={20} | ||
height={20} | ||
key={idx} | ||
/> | ||
Comment on lines
+25
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이번 과제 때 그냥 img 태그 썼었는데 next/image 구글링해보니까 nextjs 쓸때는 Image가 이미지를 최적화해서 구글 검색엔진에 노출되기 유리하도록 만든다고 하네요 담부터 image 써봐야겠어요..!!! |
||
<NaviText color="#fffff" key={idx}> | ||
{" "} | ||
{item.text}{" "} | ||
</NaviText> | ||
</> | ||
) : ( | ||
<> | ||
<Image | ||
src={`/img/navigator/${item.src}.svg`} | ||
alt="navi" | ||
width={20} | ||
height={20} | ||
key={idx} | ||
/> | ||
<NaviText key={idx}> {item.text} </NaviText> | ||
</> | ||
)} | ||
</Link> | ||
</NaviContainer> | ||
))} | ||
</> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default Navigator; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
width: 400px; | ||
height: 4rem; | ||
background-color: #121212; | ||
position: fixed; | ||
bottom: 0; | ||
`; | ||
const NaviContainer = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
padding: 1rem; | ||
`; | ||
|
||
const NaviText = styled.div<{ color?: string }>` | ||
font-size: 0.7rem; | ||
margin-top: 0.2rem; | ||
color: ${(props) => props.color || "#878787"}; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import styled from "styled-components"; | ||
|
||
const Header = () => { | ||
return ( | ||
<HeaderWrap> | ||
<Logo src="/img/home/logo.png" /> | ||
<HeaderText href="#"> TV shows </HeaderText> | ||
<HeaderText href="#"> Movies </HeaderText> | ||
<HeaderText href="#"> My List </HeaderText> | ||
</HeaderWrap> | ||
); | ||
}; | ||
|
||
export default Header; | ||
|
||
const HeaderWrap = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 380px; | ||
height: 5rem; | ||
z-index: 99; | ||
padding: 1rem 1rem 0 0; | ||
`; | ||
const Logo = styled.img` | ||
height: 3.5rem; | ||
width: 3.5rem; | ||
`; | ||
const HeaderText = styled.a` | ||
font-size: 1.1rem; | ||
font-weight: 400; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Image from "next/image"; | ||
import styled from "styled-components"; | ||
|
||
const PlayBtn = ({ width }: { width: number }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엇 Typescript를 프로젝트에 적용하면서 매번 PlayBtnProps 인터페이스를 만들었었는데 이런 간단한 방법이 있었다니.. 몰랐습니다 |
||
return ( | ||
<Play width={width}> | ||
<PlayImg src="/img/icons/play.svg" alt="playbtn" width={18} height={21} /> | ||
<div>Play</div> | ||
</Play> | ||
); | ||
}; | ||
|
||
export default PlayBtn; | ||
|
||
const Play = styled.button<{ width?: number }>` | ||
width: ${(props) => props.width || 320}px; | ||
height: 45px; | ||
border: none; | ||
border-radius: 0.4rem; | ||
background: rgb(196, 196, 196); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 20px; | ||
font-weight: 600; | ||
`; | ||
const PlayImg = styled(Image)` | ||
margin-right: 0.7rem; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import styled from "styled-components"; | ||
import Image from "next/image"; | ||
import {imgPath} from "../../asset/api-info"; | ||
|
||
const SearchItem = ({ imgSrc, name }: { imgSrc: string; name: string }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. props가 두개 이상일때는 interface를 선언하는 방법도 좋을 것 같습니다 ! |
||
return ( | ||
<ItemWrap> | ||
<img src={`${imgPath}/${imgSrc}`} style={{ width: "146px" }} /> | ||
<ItemTitle>{name}</ItemTitle> | ||
<Image src="/img/icons/play2.svg" alt="close" width={24} height={24} /> | ||
</ItemWrap> | ||
); | ||
}; | ||
|
||
export default SearchItem; | ||
|
||
const ItemWrap = styled.div` | ||
width: 400px; | ||
height: 76px; | ||
display: flex; | ||
align-items: center; | ||
overflow: hidden; | ||
background: rgb(66, 66, 66); | ||
margin: 2.5px 0; | ||
`; | ||
|
||
const ItemTitle = styled.div` | ||
width: 215px; | ||
padding-left: 20px; | ||
font-size: 15px; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
}; | ||
|
||
module.exports = nextConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인풋 과정을 따로 custom 훅으로 만드는 거 좋네용 나중에 플젝할 때 적용해봐야겠어요!😤