Skip to content

ddooo00/movie_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

64 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

ํŒ€์ŠคํŒŒ๋ฅดํƒ€ React 6๊ธฐ 10์กฐ

https://movie-app-2-ob8s-lgd65hgli-kimhwanhoon.vercel.app/

์กฐ์› ์†Œ๊ฐœ

๊ตฌ๋ถ„ ์ด๋ฆ„
์กฐ์žฅ ๊น€ํ™˜ํ›ˆ
์กฐ์› ์ด์†Œ์˜
์กฐ์› ์ตœ๋‹ค์—ฐ
์กฐ์› ํ•œํฌ
์กฐ์› ํ™ฉ๋Œ€์„ฑ

์•ฑ ์†Œ๊ฐœ

"BEST ์˜ํ™” ์•ฑ์„ ๋งŒ๋“ค์ž!"

์œ„ ๋ชฉํ‘œ๋ฅผ ๊ฐ€์ง€๊ณ  ์ •์„ฑ์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ค์–ด ๋ดค์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  ์กฐ์›์ด HTML๊ณผ, CSS, JavaScript ๊ทธ๋ฆฌ๊ณ  Github๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชฉํ‘œ๋ฅผ ๋‹ฌ์„ฑํ•˜๋ ค ๋…ธ๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค.

TMDB์˜ API๋ฅผ ์‚ฌ์šฉํ•˜์˜€์œผ๋ฉฐ, fetch์ฃผ์†Œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค.

1. ๊ธฐ๋ณธ ์ •๋ณด๋“ค ๋ฐ›๊ธฐ

fetch('https://api.themoviedb.org/3/configuration')

2. ์ธ๊ธฐ ์˜ํ™” ๋ชฉ๋ก ๋ฐ›๊ธฐ

fetch('https://api.themoviedb.org/3/discover/movie?include_adult=false&include_video=false&language=en-US&page=1&sort_by=popularity.desc')

3. ์˜ํ™” ํฌ์Šคํ„ฐ, ๋ฐฑ๋“œ๋กญ ๋“ฑ ๋ฐ›๊ธฐ

fetch(`https://api.themoviedb.org/3/movie/${movieId}/images`)

4. ์˜ํ™” ์ƒ์„ธ์ •๋ณด ๋ฐ›๊ธฐ

fetch(`https://api.themoviedb.org/3/movie/${movieId}?language=en-US`)

์•ฑ ๊ธฐ๋Šฅ

๋ฉ”์ธ ํŽ˜์ด์ง€์˜ ๊ธฐ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. ๋ฉ”์ธ์—์„œ ์˜ํ™” ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์™€์„œ ๋žœ๋ค์œผ๋กœ ์˜ํ™”๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.
  2. backdrop์„ ๋ฐ›์•„์™€์„œ ๋ฉ”์ธ ๋ฐฐ๊ฒฝํ™”๋ฉด์œผ๋กœ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
  3. ๊ฐ™์€ ์˜ํ™”์˜ ์ œ๋ชฉ, ๋‚ด์šฉ, ํ‰์  ๋“ฑ์„ ๊ฐ€์ ธ์™€์„œ ๋ฉ”์ธ์— ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.
  4. ์ฒ˜์Œ ๋กœ๋“œ์‹œ ์ธ๊ธฐ์˜ํ™” page=1์„ ๋กœ๋“œํ•˜์—ฌ ์˜ค๋ฅธ์ชฝ์— ์นด๋“œํ˜•์‹์œผ๋กœ ํ‘œํ˜„ํ•ฉ๋‹ˆ๋‹ค.
  5. ์นด๋“œ ์•ˆ์— ์™ผ์ชฝ, ์˜ค๋ฅธ์ชฝ ํ™”์‚ดํ‘œ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์นด๋“œ๊ฐ€ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  6. ์นด๋“œ ํด๋ฆญ์‹œ ์ƒ์„ธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  7. ๋ฉ”์ธ ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์˜ ๋žœ๋ค(shuffle)๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด, ์˜ํ™” ๋ชฉ๋ก์„ page 1 - 50๊นŒ์ง€ ๋žœ๋คํ•˜๊ฒŒ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ์ฆ‰, ๋ฉ”์ธ์˜ ์˜ํ™” ๋ชฉ๋ก๋“ค์ด ์ „์ฒด์ ์œผ๋กœ ๋ฐ”๋€Œ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  8. ๋ฉ”์ธ ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์˜ ๊ฒ€์ƒ‰ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๊ฒ€์ƒ‰์ฐฝ input์ด ๋‚˜์˜ค๊ฒŒ ๋˜๊ณ , ๊ฒ€์ƒ‰ํ•˜์—ฌ Enterํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ Escape ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ ์ข…๋ฃŒํ•˜๋ฉฐ ๋‹ค์‹œ ๊ฒฐ๊ณผ๋ฅผ ์ดˆ๊ธฐํ™” ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  9. ์ „๋ฐ˜์ ์œผ๋กœ ์กฐ๊ธˆ์”ฉ ๋งˆ์ด๋„ˆํ•œ ์—๋‹ˆ๋ฉ”์ด์…˜์„ ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ํšจ๊ณผ๋Š” transition: ease-in-out 0.25s;์ž…๋‹ˆ๋‹ค.
  10. ์นด๋“œ๋ฅผ ํด๋ฆญํ–ˆ์„ ๋•Œ ์ƒ์„ธํŽ˜์ด์ง€๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค. ์ด๋™ํ•˜๊ธฐ ๋ฐ”๋กœ ์ง์ „์— ๋ฉ”์ธ ํ™”๋ฉด์„ ์–ด๋‘ก๊ฒŒ ํ•˜๊ณ , ๋กœ๋”ฉํ•˜๋Š” ํšจ๊ณผ๋ฅผ ์ถ”๊ฐ€ํ•ด์„œ ์ž์—ฐ์Šค๋Ÿฌ์šด ํ™”๋ฉด์ „ํ™˜์„ ์œ ๋„ํ•˜๋Š” UX๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  11. ์นด๋“œ๋ฅผ ํด๋ฆญํ•˜์—ฌ ์ƒ์„ธํŽ˜์ด์ง€์— ์ด๋™ํ–ˆ์„ ๋•Œ, ํ•ด๋‹น ์˜ํ™”์˜ ์ •๋ณด(์ œ๋ชฉ, ์Šคํ† ๋ฆฌ ๋“ฑ)๋ฅผ localStorage์— ์ €์žฅํ•˜๊ณ , ์ƒ์„ธํŽ˜์ด์ง€์—์„œ ๊ทธ ๊ฐ’์„ ๋ถˆ๋Ÿฌ์™€ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  12. ์ƒ์„ธํŽ˜์ด์ง€์— Youtube์˜ iframe API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋™์˜์ƒ์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ๋” ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  13. ์ƒ์„ธํŽ˜์ด์ง€ ์˜ค๋ฅธ์ชฝ์— ์ €ํฌ ์กฐ์› ์†Œ๊ฐœ์™€ ํ•จ๊ป˜ ํ•œ์ค„ํ‰์„ ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค. ํ•œ์ค„ํ‰ ๋˜ํ•œ localStorage๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถˆ๋Ÿฌ์˜ค๊ณ , ์ €์žฅ๋˜๋ฉฐ, ๋น„๋ฐ€๋ฒˆํ˜ธ ๊ธฐ๋Šฅ๊ณผ ํ•จ๊ป˜ ์ˆ˜์ •๊ณผ ์‚ญ์ œ๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
  14. ๊ด€๋žŒํ‰์“ฐ๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๋ฐ”๋กœ ๋ฐ˜์‘ํ•˜์ง€ ์•Š๊ณ  ๊ฐ„๋‹จํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ๊ตฌํ˜„ํ•˜์—ฌ ๋ฒ„ํŠผ์ด ์™ผ์ชฝ์—์„œ ์˜ค๋ฅธ์ชฝ์œผ๋กœ ๋‹ค ์ด๋™ํ–ˆ์„ ๋•Œ, ๊ธฐ๋Šฅ์ด ์ž‘๋™ํ•˜๋„๋ก ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ์ˆœ๊ฐ„๊ณผ ํด๋ฆญ์ด ๋๋‚œ ์ˆœ๊ฐ„์„ ์บ์น˜ํ•˜์—ฌ ๋‘˜์„ ๋บ€ ๊ฐ’์„ 600ms๋กœ ์„ค์ •ํ•˜์—ฌ ์ด๋ฒคํŠธ๋ฅผ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋งˆ๋ฌด๋ฆฌ

์ €ํฌ ํŒ€์›๋“ค ๊ณ ์ƒ ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์ €ํฌ๊ฐ€ ํ•œ ์ฃผ ๋™์•ˆ ๋งŽ์€ ์‹œ๊ฐ„ ์จ๊ฐ€๋ฉฐ ๋งŒ๋“  ์‚ฌ์ดํŠธ ๋ด์ฃผ์…”์„œ ์ง„์‹ฌ์œผ๋กœ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

์ž‘์„ฑ์ผ: 2023. 6. 9 | ์ž‘์„ฑ์ž: ํŒ€์žฅ ๊น€ํ™˜ํ›ˆ