Skip to content
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

Kdt5 ju ha rim #63

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Kdt5 ju ha rim #63

wants to merge 5 commits into from

Conversation

wngkfla01
Copy link

@wngkfla01 wngkfla01 commented May 10, 2023

🎬 μ˜ν™” 검색

배포링크: https://roaring-dolphin-d6dd06.netlify.app

βœ… HTML, JS μ‚¬μš©

❗ ν•„μˆ˜

  • μ˜ν™” 제λͺ©μœΌλ‘œ 검색이 κ°€λŠ₯ν•΄μ•Ό ν•©λ‹ˆλ‹€!
  • κ²€μƒ‰λœ 결과의 μ˜ν™” λͺ©λ‘μ΄ 좜λ ₯돼야 ν•©λ‹ˆλ‹€!
  • 단일 μ˜ν™”μ˜ 상세정보(제λͺ©, κ°œλ΄‰μ—°λ„, 평점, μž₯λ₯΄, 감독, 배우, 쀄거리, ν¬μŠ€ν„° λ“±)λ₯Ό λ³Ό 수 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€!
  • μ‹€μ œ μ„œλΉ„μŠ€λ‘œ λ°°ν¬ν•˜κ³  μ ‘κ·Ό κ°€λŠ₯ν•œ 링크λ₯Ό μΆ”κ°€ν•΄μ•Ό ν•©λ‹ˆλ‹€.

❔ 선택

  • ν•œ 번의 κ²€μƒ‰μœΌλ‘œ μ˜ν™” λͺ©λ‘μ΄ 20개 이상 κ²€μƒ‰λ˜λ„λ‘ λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™” κ°œλ΄‰μ—°λ„λ‘œ 검색할 수 μžˆλ„λ‘ λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™” λͺ©λ‘μ„ κ²€μƒ‰ν•˜λŠ” λ™μ•ˆ λ‘œλ”© μ• λ‹ˆλ©”μ΄μ…˜μ΄ 보이도둝 λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • λ¬΄ν•œ 슀크둀 κΈ°λŠ₯을 μΆ”κ°€ν•΄μ„œ μΆ”κ°€ μ˜ν™” λͺ©λ‘μ„ λ³Ό 수 μžˆλ„λ‘ λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™” ν¬μŠ€ν„°κ°€ 없을 경우 λŒ€μ²΄ 이미지λ₯Ό 좜λ ₯ν•˜λ„λ‘ λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™” 상세정보가 좜λ ₯되기 전에 λ‘œλ”© μ• λ‹ˆλ©”μ΄μ…˜μ΄ 보이도둝 λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™” 상세정보 ν¬μŠ€ν„°λ₯Ό κ³ ν•΄μƒλ„λ‘œ 좜λ ₯ν•΄λ³΄μ„Έμš”. (μ‹€μ‹œκ°„ 이미지 리사이징)
  • 차별화가 κ°€λŠ₯ν•˜λ„λ‘ ν”„λ‘œμ νŠΈλ₯Ό μ΅œλŒ€ν•œ 예쁘게 λ§Œλ“€μ–΄λ³΄μ„Έμš”.
  • μ˜ν™”μ™€ κ΄€λ ¨λœ 기타 κΈ°λŠ₯도 κ³ λ €ν•΄λ³΄μ„Έμš”.

배운점

  • Javascriptμ—μ„œ μ»΄ν¬λ„ŒνŠΈ, λΌμš°ν„° ꡬ성, μƒνƒœκ΄€λ¦¬μ˜ κ°œλ…μ— λŒ€ν•΄ 곡뢀할 수 μžˆμ—ˆμŠ΅λ‹ˆλ‹€.

μ•„μ‰¬μš΄μ 

  • μŠ€νƒ€μΌμ„ κ°œμ„±μžˆκ²Œ 바꿔보고 μ‹Άμ–΄μ„œ μΆ”ν›„ λ³€κ²½ν•΄λ³Ό μ˜ˆμ •μž…λ‹ˆλ‹€.

Copy link

@chanuuuuu chanuuuuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reactλ₯Ό μ•Œκ³ κ³„μ‹œλ‹€λ³΄λ‹ˆ, 바닐라 JSλ₯Ό ν†΅ν•΄μ„œ 'store'의 λ‘œμ§μ„ 직접 κ΅¬ν˜„ν•˜λŠ” 것이 μ‰½μ§€μ•Šμ€ μ„ νƒμ΄μ—ˆμ„ν…λ° κ³ μƒν•˜μ…¨μŠ΅λ‹ˆλ‹€πŸ‘πŸ» λŒ€μ‹  λ‹¨μˆœνžˆ κ°•μ˜μ˜ λ‚΄μš©μ„ λ”°λΌκ°€λŠ” 것 뿐 만 μ•„λ‹ˆλΌ state의 λ‚΄λΆ€ 둜직이 μ–΄λ–»κ²Œ μ§„ν–‰λ˜κ³  있고, 클래슀둜 κ΅¬ν˜„λœ μ»΄ν¬λ„ŒνŠΈλ“€μ˜ constructor render λ©”μ„œλ“œκ°€ μ–΄λŠμ‹œμ μ— ν˜ΈμΆœλ˜λŠ”μ§€ μ„ΈλΆ€μ μœΌλ‘œ λ“€μ—¬λ‹€λ³Ό 수 μžˆμ—ˆμœΌλ©΄ ν•©λ‹ˆλ‹€.

μΆ”κ°€μ μœΌλ‘œ λͺ‡κ°€μ§€ 생각해볼 뢀뢄을 μ½”λ©˜νŠΈ λ“œλ ΈμŠ΅λ‹ˆλ‹€. ν™•μΈν•΄λ³΄μ‹œκ³  λ¦¬ν”Œ λ‹¬μ•„μ£Όμ„Έμš”! κ³ μƒν•˜μ…¨μŠ΅λ‹ˆλ‹€.πŸ™‡πŸ»β€β™‚οΈ

<title>Movie App</title>
<link rel="icon" href="./favicon.ico">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/reset.min.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preconnectλ₯Ό μ‚¬μš©ν•˜μ—¬ font νŒŒμΌμ„ λ“€κ³ μ˜€κ³  μžˆλ„€μš”:) ν•΄λ‹Ή 속성이 μ–΄λ– ν•œ 의미둜 μ‚¬μš©λ˜κ³  μžˆλŠ”μ§€ 또 μ–΄λ–€ νš¨κ³Όκ°€ μžˆμ–΄μ„œ μΆ”κ°€ν•œ 것인지 μ„€λͺ…ν•΄μ£Όμ‹€ 수 μžˆμ„κΉŒμš”?

<div class="the-loader hide"></div>
`

const moviesEl = this.el.querySelector(".movies");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ˜ν™” λͺ©λ‘ νƒœκ·Έλ₯Ό 클래슀λͺ…μœΌλ‘œ μ‘°νšŒν•˜κ³  μžˆλŠ”λ°, CSS νŠΉμ΄μ„±μ— λ”°λ₯΄λ©΄ κ΅¬ν˜„ν•˜μ‹  νŽ˜μ΄μ§€ λ‚΄μ—μ„œ MovieList μ»΄ν¬λ„ŒνŠΈλŠ” ν•˜λ‚˜λ§Œ μ‚¬μš©λ˜λ―€λ‘œ 클래슀λͺ…이 μ•„λ‹Œ IDλ₯Ό ν†΅ν•΄μ„œ μš”μ†Œλ₯Ό μ‘°νšŒν•˜λŠ” 것이 더 효율적일 κ²ƒμœΌλ‘œ λ³΄μž…λ‹ˆλ‹€. 이와 λ§ˆμ°¬κ°€μ§€λ‘œ μ•„λž˜μ˜ loadEl λ˜ν•œ IDλ₯Ό ν†΅ν•΄μ„œ μ‘°νšŒν•˜λŠ” 방식을 κ²€ν† ν•  수 μžˆμ„ 것 κ°™μ•„μš”! 클래슀λͺ…을 μ‚¬μš©ν•˜μ—¬ μ‘°νšŒν•΄μ•Όν•œλ‹€λ©΄ κ·Έ μ΄μœ λ„ μ„€λͺ…ν•΄μ£Όμ‹€ 수 μžˆμ„κΉŒμš”?πŸ€”

export default class MovieList extends Component {
constructor(){
super()
movieStore.subscribe('movies', ()=>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ν•΄λ‹Ή μ½”λ“œμ™€ λ™μΌν•˜κ²Œ state의 값에 변화에 따라 ν•΄λ‹Ή μ»΄ν¬λ„ŒνŠΈμ˜ λ¦¬λ Œλ”λ§μ„ λ“±λ‘ν•˜λŠ” μž‘μ—…μ„ constructor에 μž‘μ„±ν•˜μ…¨λ„€μš”. μ•„λž˜μ˜ render() λ©”μ„œλ“œκ°€ μ•„λ‹ˆλΌ constructor()에 μž‘μ„±ν•˜μ…¨λŠ”μ§€ κΆκΈˆν•©λ‹ˆλ‹€!

.the-loader.hide {
display: none;
}
@keyframes loader {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyframes μ–΄λ…Έν…Œμ΄μ…˜μ€ μ–΄λ–€ 의미λ₯Ό κ°€μ§€λŠ”μ§€ κΆκΈˆν•©λ‹ˆλ‹€πŸ€” μ˜λ―Έμ™€ μž‘μ„± μ˜λ„λ₯Ό μ„€λͺ…ν•΄μ£Όμ‹€ 수 μžˆλ‚˜μš”?


export default store
export const searchMovies = async page => {
store.state.loading = true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ½”λ“œλΌμΈλ§ˆλ‹€ μ„Έλ―Έμ½œλ‘ ;이 λΆ™μ–΄μžˆμ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ¬Όλ‘  λ°˜λ“œμ‹œ ν•„μš”ν•œ 것은 μ•„λ‹ˆμ§€λ§Œ, 가독성을 μœ„ν•΄μ„œ μΆ”κ°€ν•˜λŠ” 것이 쒋을 κ²ƒμœΌλ‘œ λ³΄μž…λ‹ˆλ‹€. lint섀정을 ν†΅ν•΄μ„œ μ €μž₯μ‹œμ— μžλ™μœΌλ‘œ μ„Έλ―Έμ½œλ‘ μ΄ 뢙을 수 μžˆλ„λ‘ μΆ”κ°€ν•  수 μžˆμœΌλ‹ˆ λ„μž…μ„ κ²€ν† ν•΄λ³΄μ‹œλŠ” 것은 μ–΄λ–¨κΉŒμš”? μ•„λž˜λŠ” VScode의 'lint'μ„€μ •λ°©λ²•μž…λ‹ˆλ‹€.

VS code의 'lint' 섀정방법

store.state.message = ''
}
try {
const res = await fetch(`https://omdbapi.com?apikey=7035c60c&s=${store.state.searchText}&page=${store.state.page}`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ§€λ‚œλ²ˆμ— λ©˜ν† λ§ μ‹œκ°„μ—λ„ κ³΅μœ λ˜μ—ˆλ˜ 뢀뢄인 fetchλ₯Ό ν†΅ν•΄μ„œ HTTP μš”μ²­μ„ κ°€μ Έμ˜€λŠ” λ‘œμ§μ€ λ”°λ‘œ λΆ„λ¦¬ν•˜μ—¬ κ΄€λ¦¬ν•˜λŠ” κ²ƒμœΌλ‘œ λ¦¬νŒ©ν† λ§ ν•΄λ³΄λŠ” 것은 μ–΄λ–¨κΉŒμš”? 이λ₯Ό 톡해 storeλŠ” λ‹¨μˆœνžˆ μƒνƒœκ΄€λ¦¬ λ‘œμ§μ„ λ‹΄λ‹Ήν•˜κ³  API츑은 HTTP μš”μ²­ λ‘œμ§μ„ λ‹΄λ‹Ήν•˜μ—¬ μ±…μž„μ„ 뢄리할 수 μžˆμ„ κ²ƒμœΌλ‘œ λ³΄μž…λ‹ˆλ‹€.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants