Skip to content

[4์ฃผ์ฐจ-TS] ๐ŸŽค๋…ธ์ธ์ฝ”๋ž˜๋ฐฉ๐ŸŽค - #7

Open
leeseooo wants to merge 14 commits into
mainfrom
week4-ts
Open

[4์ฃผ์ฐจ-TS] ๐ŸŽค๋…ธ์ธ์ฝ”๋ž˜๋ฐฉ๐ŸŽค#7
leeseooo wants to merge 14 commits into
mainfrom
week4-ts

Conversation

@leeseooo

Copy link
Copy Markdown
Collaborator

โœจ ๊ตฌํ˜„ ๊ธฐ๋Šฅ ๋ช…์„ธ

  • ์ง€์—ญ๊ธฐ๋ฐ˜, ๋™๋„ค๊ธฐ๋ฐ˜ ๋…ธ๋ž˜๋ฐฉ ๊ฒ€์ƒ‰

๐ŸŽ PR Point

์งˆ๋ฌธ์žˆ์–ด์š”

  • ์ž๋™์œผ๋กœ ํƒ€์ž… ์ถ”๋ก ์ด ๋˜๋ฉด ๊ตณ์ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š์•„๋„ ๊ดœ์ฐฎ์€์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!
  • components ํด๋”์˜ ์ปดํฌ๋„ŒํŠธ๋“ค์˜ ๋„ค์ด๋ฐ์ด ํ˜น์‹œ ์–ด์ƒ‰ํ•˜์ง€ ์•Š์€์ง€ ๊ถ๊ธˆํ•ด์š”! ๊ฒ€์ƒ‰ํ•˜๋Š” ์˜์—ญ, ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์˜์—ญ์ด๋ผ๋Š” ์˜๋ฏธ๋กœ ~Section์ด๋ผ๊ณ  ์ง€์—ˆ๊ธด ํ•œ๋ฐ ์ž‘๋ช…์ด ์ œ์ผ ์–ด๋ ต๋”๋ผ๊ณ ์š”?
  • ResultSection.tsx ์ปดํฌ๋„ŒํŠธ์—์„œ api์š”์ฒญ ํ›„ ๊ฒ€์ƒ‰๊ฒฐ๊ณผ ์ถœ๋ ฅํ•  ๋•Œ ๋ฐ‘์— ๋‘ ๋ฐฉ๋ฒ• ์ค‘์—์„œ ๋ญ๊ฐ€ ๋” ๋‚˜์„๊นŒ์š”? ์•„๋‹ˆ๋ฉด ์–˜๋„ค๋ณด๋‹ค ๋” ์ข‹์€ ๋‹ค๋ฅธ ํ‘œํ˜„ ๋ฐฉ๋ฒ•์ด ์žˆ์„๊นŒ์š”?
  1. ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋กœ ํ‘œํ˜„
{!isLoading && storeInfo.length === 0 ? (
        <div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
      ) : (
        storeInfo?.map((store: Store, idx: number) => (
          <StoreCard key={idx} store={store} isCheck={isCheck} />
        ))
      )}
  1. ๊ฐ๊ฐ &&๋กœ ํ‘œํ˜„ -> !isLoading์ด ์ค‘๋ณต๋จ
 {!isLoading && storeInfo.length === 0 && (
        <div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
      )}
{!isLoading &&
        storeInfo?.map((store: Store, idx: number) => (
          <StoreCard key={idx} store={store} isCheck={isCheck} />
))}

๐Ÿ˜ญ ์–ด๋ ค์› ๋˜ ์ 

๐Ÿ˜Ž ๊ตฌํ˜„ ๊ฒฐ๊ณผ๋ฌผ

Vite.App.-.Chrome.2022-06-25.00-26-29_Trim.mp4

@leeseooo leeseooo added the 4๏ธโƒฃ 4์ฃผ์ฐจ 4์ฃผ์ฐจ ๊ณผ์ œ์—์š”. label Jun 24, 2022
@leeseooo leeseooo self-assigned this Jun 24, 2022
@github-actions

Copy link
Copy Markdown

์˜ค๋Š˜๋„ ํ• ํ• ๋†€๋†€์„ ๋ชธ์†Œ ์‹ค์ฒœ ์ค‘์ธ ์›นํŒŒํŠธ์› ! ํ™”์ดํŒ… :)
๊ณผ์ œ ๋ ˆํผ๋Ÿฐ์Šค ์ฐธ๊ณ ํ•ด์„œ ๋น ํŠธ๋ฆฐ ๋ถ€๋ถ„์€ ์—†๋Š” ์ง€ ์ฒดํฌํ•ด๋ณผ๊นŒ์š”?

@joohaem joohaem left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๋ฉ‹์ง€๋„ค์š” !!!!! ํ›„์— ์ œ๋Œ€๋กœ ๋ฆฌ๋ทฐํ•˜๊ฒ ์”๋‹ˆ๋‹ค!

@Nahee-Park Nahee-Park left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๋ฉ‹์ ธ์—ฌ !!!!! ์Šค์ผˆ๋ ˆํ†ค์— ts๊นŒ์ง€ ์•ผ๋ฌด์ง€๊ฒŒ ์ž˜ ์“ฐ์‹  ๊ฒƒ ๊ฐ™์Šต๋ฏธ๋‹ค !!!!

  1. ์ž๋™์œผ๋กœ ํƒ€์ž… ์ถ”๋ก ์ด ๋˜๋ฉด ๊ตณ์ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š์•„๋„ ๊ดœ์ฐฎ์€์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค!
  • ๋‹ค๋ฅธ ์–ธ์–ด๋“ค๊ณผ๋Š” ๋‹ฌ๋ฆฌ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋Š” ํƒ€์ž… ์ถ”๋ก ์ด ๋˜๋„๋ก ์œ ๋„ํ•˜๊ณ , ํƒ€์ž…์ด ์ถ”๋ก ๋˜๋Š” ๊ฒฝ์šฐ ๊ตณ์ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ปจ๋ฒค์…˜์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ €๋„ ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด ๋ช…ํ™•ํ•˜๊ฒŒ ์™œ ๊ทธ๋ ‡๊ฒŒ ํ•˜๋Š” ์ง€ ์ด์œ ๋ฅผ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ์™œ๋ƒํ•˜๋ฉด ํƒ€์–ธ์–ด์—์„  ํƒ€์ž…์ด ์ถ”๋ก ๋˜๋Š” ์›์‹œํƒ€์ž…๋“ค๋„
์ฝ”๋“œ์— ๋ช…์‹œ์ ์œผ๋กœ ํƒ€์ž…์„ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•ด (์‚ฌ๋žŒ์„ ์œ„ํ•ด)
์ปดํŒŒ์ผ ๋‹จ๊ณ„์—์„œ ๋ถˆํ•„์š”ํ•œ ํƒ€์ž… ์ถ”๋ก  ๋‹จ๊ณ„๋ฅผ ์ค„์ด๊ธฐ ์œ„ํ•ด (์ปดํ“จํ„ฐ๋ฅผ ์œ„ํ•ด)
  • ์œ„์™€ ๊ฐ™์€ ์ด์œ ๋“ค๋กœ ํ•ญ์ƒ ํƒ€์ž…์„ ๋ช…์‹œํ•  ๊ฒƒ์„ ๊ถŒ์žฅํ•˜๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ๋“ค์ด ๋งŽ๋”๋ผ๊ตฌ์š”. ์–ด๋– ํ•œ ์ด์œ ๋กœ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ์—์„œ๋Š” ํƒ€์ž… ์ถ”๋ก ์ด ์ปจ๋ฒค์…˜์ด ๋œ ๊ฒƒ์ธ์ง€๋Š” .. ์ €๋„ ์ƒ๊ฐ์„ ๋‚˜๋ˆ ๋ณด๊ณ  ์‹ถ์€ ์ฃผ์ œ์ธ ๊ฒƒ ๊ฐ™์•„์š”
  1. components ํด๋”์˜ ์ปดํฌ๋„ŒํŠธ๋“ค์˜ ๋„ค์ด๋ฐ์ด ํ˜น์‹œ ์–ด์ƒ‰ํ•˜์ง€ ์•Š์€์ง€ ๊ถ๊ธˆํ•ด์š”! ๊ฒ€์ƒ‰ํ•˜๋Š” ์˜์—ญ, ๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์˜์—ญ์ด๋ผ๋Š” ์˜๋ฏธ๋กœ ~Section์ด๋ผ๊ณ  ์ง€์—ˆ๊ธด ํ•œ๋ฐ ์ž‘๋ช…์ด ์ œ์ผ ์–ด๋ ต๋”๋ผ๊ณ ์š”?
  • ์ด๊ฑด .. ํ•ญ์ƒ ์ •๋ง ์–ด๋ ต๊ณ  ๊ฐœ์ธ ์ทจํ–ฅ๋„ ๋ฐ˜์˜๋˜๊ณ  ์ปจ๋ฒค์…˜๋„ ๋ฐ˜์˜๋˜๋Š” ์˜์—ญ์ธ ๊ฒƒ ๊ฐ™์•„์š”. ๊ทผ๋ฐ ํ˜„์žฌ ์ œ ๊ฐœ์ธ์ ์ธ ์ƒ๊ฐ์œผ๋กœ ์–ด์ƒ‰ํ•œ ์ปดํฌ๋„ŒํŠธ ๋ช…์€ ์—†๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค !
  1. ResultSection.tsx ์ปดํฌ๋„ŒํŠธ์—์„œ api์š”์ฒญ ํ›„ ๊ฒ€์ƒ‰๊ฒฐ๊ณผ ์ถœ๋ ฅํ•  ๋•Œ ๋ฐ‘์— ๋‘ ๋ฐฉ๋ฒ• ์ค‘์—์„œ ๋ญ๊ฐ€ ๋” ๋‚˜์„๊นŒ์š”? ์•„๋‹ˆ๋ฉด ์–˜๋„ค๋ณด๋‹ค ๋” ์ข‹์€ ๋‹ค๋ฅธ ํ‘œํ˜„ ๋ฐฉ๋ฒ•์ด ์žˆ์„๊นŒ์š”?
  • ์ด ๋ถ€๋ถ„ ๋ฆฌ๋ทฐ์—๋„ ์ •๋ฆฌํ•ด๋ณด์•˜๋Š”๋ฐ ๊ฐ€๋…์„ฑ์„ ์œ„ํ•ด ์ค‘์ฒฉ ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋ฅผ ์ง€์–‘ํ•˜๋Š” ๋ฐฉ์‹์ด ์ข‹์€ ๊ฒƒ ๊ฐ™๊ณ , ํ˜น์€ ์กฐ๊ฑด๋ถ€ ๋ Œ๋”๋ง์„ ๊ณ ๋ คํ•ด๋ณด๋Š” ๊ฒƒ๋„ ์ข‹์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!

Comment on lines +18 to +28
{isLoading &&
new Array(10).fill(1).map((_, idx) => {
return <Skeleton key={idx} />;
})}
{!isLoading && storeInfo.length === 0 ? (
<div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
) : (
storeInfo?.map((store: Store, idx: number) => (
<StoreCard key={idx} store={store} isCheck={isCheck} />
))
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์˜ค ๊ฐœ์ธ์ ์œผ๋กœ ์ค‘์ฒฉ ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋ณด๋‹ค &&์™€ ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋ฅผ ํ•จ๊ป˜ ์“ด ์ด ๋ฐฉ์‹์ด ํ™•์‹คํžˆ ์ข€ ๋” ๊ฐ€๋…์„ฑ ์ข‹์€ ๋ฐฉ์‹์ธ ๊ฑฐ ๊ฐ™์•„์š”!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๋ณดํŽธ์ ์œผ๋กœ ๋งŽ์ด ์“ฐ์ด๋Š” eslint airbnb js ์Šคํƒ€์ผ ๊ฐ€์ด๋“œ์— ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฃฐ์ด ์žˆ๋Š”๋ฐ ํ•œ ๋ฒˆ ์ฝ์–ด๋ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”! (๋ฌผ๋ก  ์ด ๊ฐ€์ด๋“œ๋Š” ์ ˆ๋Œ€ ์ •๋‹ต์ด ์•„๋‹ˆ๊ณ  ํ˜‘์—…ํ•  ๋•Œ๋งˆ๋‹ค ๋‹ค๋ฅธ lint๋ฃฐ์„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋  ๊ฑฐ๋ผ ์ •๋ง ์ฐธ๊ณ ์šฉ์ž…๋ฏธ๋‹ค ! )
image
https://github.com/parksb/javascript-style-guide

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์ฐธ๊ณ ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค ๊ณ ๋งˆ์›Œ์š”!!

Comment on lines +18 to +28
{isLoading &&
new Array(10).fill(1).map((_, idx) => {
return <Skeleton key={idx} />;
})}
{!isLoading && storeInfo.length === 0 ? (
<div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
) : (
storeInfo?.map((store: Store, idx: number) => (
<StoreCard key={idx} store={store} isCheck={isCheck} />
))
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
{isLoading &&
new Array(10).fill(1).map((_, idx) => {
return <Skeleton key={idx} />;
})}
{!isLoading && storeInfo.length === 0 ? (
<div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
) : (
storeInfo?.map((store: Store, idx: number) => (
<StoreCard key={idx} store={store} isCheck={isCheck} />
))
)}
if(isLoading) {
new Array(10).fill(1).map((_, idx) => {
return <Skeleton key={idx} />;
})
} else {
return (
<>
{storeInfo.length === 0 ? (
<div style={{ color: "#fff" }}>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.</div>
) : (
storeInfo?.map((store: Store, idx: number) => (
<StoreCard key={idx} store={store} isCheck={isCheck} />
))
)}
</>
)
}

ํ˜น์€ ์ด๋Ÿฐ ์‹์œผ๋กœ ์กฐ๊ฑด๋ถ€ ๋ Œ๋”๋ง์„ ํ•˜๋Š” ๋ฐฉ์‹๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์—ฌ !

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ํ˜น์€ ๋‚˜์ค‘์— ์„œ๋ฒ„์‚ฌ์ด๋“œ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์ƒํƒœ๋ฅผ ๋กœ๋”ฉ ์ƒํƒœ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์—๋Ÿฌ ์ƒํƒœ๊นŒ์ง€ ํ™•์žฅ์‹œํ‚จ๋‹ค๋ฉด ์ด๋Ÿฐ ์‹์œผ๋กœ switch-case๋ฌธ์„ ์ด์šฉํ•œ ์กฐ๊ฑด๋ถ€๋ Œ๋”๋ง์„ ํ•  ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š” !

function Result({ isEmpty, keywordLocationData, status }: ResultProps) {
  switch (status) {
    case 'LOADING':
      return <Loading />;
    case 'ERROR':
      return <ErrorFallback />;
    default:
      return isEmpty ? <NoResult /> : <CardList keywordLocationData={keywordLocationData} />;
  }
}

๊ทผ๋ฐ ์‚ฌ์‹ค ์ด๊ฑฐ ๋‹ค ๊ฐ ์ทจ์ธ ์˜์—ญ์ด๋ผ ์ •๋‹ต์€ ์—†์–ด์„œ ๊ฐ ์ทจ๋Œ€๋กœ ๊ฐˆ๊ธฐ๋ฉด ๋  ๊ฑฐ ๊ฐ™๊ธด ํ•ด์—ฌ ใ…‹ ใ…‹

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์•„ ์ €๋ ‡๊ฒŒ ํ•˜๋ฉด ๋˜๋Š”๊ตฌ๋‚˜ ใ…‹ใ…‹์ €๋Ÿฐ์‹์œผ๋กœ ๊ฐˆ๊ฒจ๋ณผ๊ฒŒ์—ฌ
switch๋ฌธ ์ƒํƒœ ์ฒ˜๋ฆฌ ์ฝ”๋“œ๋„ ์ฐธ๊ณ ํ• ๊ฒŒ์š” ๊ฐ์‚ผ๋‹ท!

Comment on lines +9 to +10
const [isCheck, setIsCheck] = useState<boolean>(false);
const [myTown, setMyTown] = useState<string>("");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

state๋กœ input value๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ์žˆ๋‹ค๋ฉด useInput๊ฐ™์€ ์ปค์Šคํ…€ ํ›…์„ ์ •์˜ํ•ด์„œ ์‚ฌ์šฉํ•ด๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์ปค์Šคํ…€ ํ›…์— ๊ด€ํ•ด์„œ https://react.vlpt.us/basic/21-custom-hook.html ์ด๋Ÿฐ ์ž๋ฃŒ๋“ค ๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์—ฌ !

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์ด๋ฒˆ ๊ธฐํšŒ์— ์ปค์Šคํ…€ ํ›…์„ ํ•œ ๋ฒˆ ์‹œ๋„ํ•ด๋ณผ๊ฒŒ์—ฌ

background-color: #bdbdbd;
`;

export default Skeleton;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ํฌ. .. .์Šค์ผˆ๋ ˆํ†ค ๋ฉ‹์žˆ์–ด์—ฌ

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

๋ฐ๋ธŒ์Šคํ†ค์ด ๋” ๋ฉ‹์žˆ์–ด์—ฌ

Comment on lines +16 to +56
return (
<StWrapper>
<StCheckBoxWrapper>
<label htmlFor="checkbox">์ง€์—ญ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฒ€์ƒ‰</label>
<input
type="checkbox"
id="checkbox"
onChange={() => setIsCheck(!isCheck)}
/>
</StCheckBoxWrapper>

<StTextInputWrapper>
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
disabled={isCheck}
value={myTown}
onChange={(e) => setMyTown(e.target.value)}
/>
</StTextInputWrapper>

<StSearchButton type="button" onClick={() => onClick(isCheck, myTown)}>
๊ฒ€์ƒ‰ํ•˜๊ธฐ
</StSearchButton>
</StWrapper>
);
}

const StWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 10px 0;
gap: 10px;
font-size: 20px;
color: #fff;
border-bottom: 2px solid #fff;
width: 100%;
`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์ด ๋ถ€๋ถ„ formํ…Œ๊ทธ๋กœ wrappingํ•ด์„œ ์‚ฌ์šฉํ•˜๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”!

Suggested change
return (
<StWrapper>
<StCheckBoxWrapper>
<label htmlFor="checkbox">์ง€์—ญ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฒ€์ƒ‰</label>
<input
type="checkbox"
id="checkbox"
onChange={() => setIsCheck(!isCheck)}
/>
</StCheckBoxWrapper>
<StTextInputWrapper>
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
disabled={isCheck}
value={myTown}
onChange={(e) => setMyTown(e.target.value)}
/>
</StTextInputWrapper>
<StSearchButton type="button" onClick={() => onClick(isCheck, myTown)}>
๊ฒ€์ƒ‰ํ•˜๊ธฐ
</StSearchButton>
</StWrapper>
);
}
const StWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 10px 0;
gap: 10px;
font-size: 20px;
color: #fff;
border-bottom: 2px solid #fff;
width: 100%;
`;
return (
<StForm onSubmit={(e) => onClick(isCheck, myTown, e)}>
<StCheckBoxWrapper>
<label htmlFor="checkbox">์ง€์—ญ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฒ€์ƒ‰</label>
<input
type="checkbox"
id="checkbox"
onChange={() => setIsCheck(!isCheck)}
/>
</StCheckBoxWrapper>
<StTextInputWrapper>
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
disabled={isCheck}
value={myTown}
onChange={(e) => setMyTown(e.target.value)}
/>
</StTextInputWrapper>
<StSearchButton type="submit">
๊ฒ€์ƒ‰ํ•˜๊ธฐ
</StSearchButton>
</StForm>
);
}
const StForm = styled.form`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 10px 0;
gap: 10px;
font-size: 20px;
color: #fff;
border-bottom: 2px solid #fff;
width: 100%;
`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๊ทผ๋ฐ form tag๋ฅผ ์“ฐ๊ณ  onSubmit์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋ฉด ๋””ํดํŠธ๋กœ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์ƒˆ๋กœ๊ณ ์นจํ•˜๋Š” ๋™์ž‘์„ ๋„ฃ์–ด๋ฒ„๋ ค์„œ onSubmit์ด๋ฒคํŠธ ๋‚ด๋ถ€์— ๋“ค์–ด์žˆ๋Š” ํ•จ์ˆ˜์—์„œ ๊ทธ๋Ÿฐ ๋ถˆํ•„์š”ํ•œ ๋””ํดํŠธ ๋™์ž‘์„ ๋ง‰์•„์ค˜์•ผ ํ•˜๋Š”๋ฐ (SPA์—์„œ ์ƒˆ๋กœ๊ณ ์นจ์€ ๋ถˆํ•„์š”ํ•œ ๋™์ž‘์ด๋‹ˆ๊นŒ์—ฌ !) ๊ทธ๋Ÿฌ๊ธฐ ์œ„ํ•ด์„œ

  1. ์ผ๋‹จ event์ธ์ž๋ฅผ ๋ฐ›์•„์ฃผ๋„๋ก ์ˆ˜์ •ํ•˜๊ณ ,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์•„ 7์ฃผ์ฐจ ๊ณผ์ œ์—์„œ ์ด๋Ÿฐ ์‹์œผ๋กœ ์งฐ์—ˆ๋Š”๋ฐ ์ด๊ฒƒ๋„ ๊ทธ๋ ‡๊ฒŒ ๋ฐ”๊ฟ”๋ณผ๊ฒŒ์š”!
์ด ๋ฐฉ๋ฒ•์ด ๋” ์ข‹์•„๋ณด์ด๋„ค์š”

const [isChecked, setIsChecked] = useState<boolean>(false);
const [isLoading, setIsLoading] = useState(false);

const onClickSearchButton = (isCheck: boolean, myTown: string) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์ƒˆ๋กœ๊ณ ์นจ๋˜๋Š” ์ด๋ฒคํŠธ ๋””ํดํŠธ ๋™์ž‘์„ ๋ง‰๊ธฐ ์œ„ํ•ด

Suggested change
const onClickSearchButton = (isCheck: boolean, myTown: string) => {
const onClickSearchButton = (isCheck: boolean, myTown: string, e:React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
  1. ์ด๋Ÿฐ ์‹์œผ๋กœ event๋ฅผ ๋ฐ›์•„์„œ e.preventDefault();๋ฅผ ํ†ตํ•ด ๋””ํดํŠธ ์ด๋ฒคํŠธ๋ฅผ ๋ง‰์•„์ฃผ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋ฏธ๋‹ค!

@joohaem joohaem left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

๊ฐœ์ž๋ž˜์ด์„œ์˜๐Ÿ˜ฃ๐Ÿ‘๐ŸŽ†๐Ÿ‰


๊ฒฐ๊ณผ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์˜์—ญ์ด๋ผ๋Š” ์˜๋ฏธ๋กœ ~Section์ด๋ผ๊ณ  ์ง€์—ˆ๊ธด ํ•œ๋ฐ

๋‚˜๋„ ๊ทธ๋ ‡๊ฒŒ ์ง€์—ˆ๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ ๋‚˜ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š”

  1. ํ•ด๋‹น ํŽ˜์ด์ง€์— 3๊ฐœ์˜ section๋งŒ ์กด์žฌํ•˜์—ฌ ์œ„๊ณ„๊ฐ€ ๊ฐ™์Œ
  2. ๊ฐ๊ฐ ์‹œ๋ฉ˜ํ‹ฑ ํƒœ๊ทธ section์„ ์‚ฌ์šฉํ•  ๊ฒƒ์ž„

์ด๋Ÿฐ ์ด์œ ๋กœ ๊ทธ๋ ‡๊ฒŒ ๋„ค์ด๋ฐ ํ–ˆ๋˜ ๊ฒƒ ๊ฐ™์•„!


1, 3๋ฒˆ ๋ถ€๋ถ„์€ ๋‚˜ํžˆ๊ฐ€ ์„ค๋ช… ์ž˜ ํ•ด์ค€ ๊ฒƒ ๊ฐ™๋„ค์š”!!!! ๋ฐฐ์›Œ๊ฐ‘๋ฏธ๋‹ค....๋‚˜์ปค๋ฐ•๐Ÿคฉ๐Ÿคฉ @Nahee-Park

Comment thread week4-ts/package.json
Comment on lines +10 to +11
"dependencies": {
"@types/styled-components": "^5.1.25",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ํƒ€์ž… ๊ด€๋ จ ์˜์กด์„ฑ์€ ๊ฐœ๋ฐœํ™˜๊ฒฝ์—์„œ ํ•„์š”ํ•˜๊ธฐ ๋–„๋ฌธ์— devDependencies ์— ์„ ์–ธํ•ด์ฃผ์–ด๋„ ์ข‹์•„

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์•„ํ•˜ ์˜คํ‚ค์˜คํ‚ค

Comment on lines +20 to +30
return data.documents;
};

export const getStoreBasedTown = async (town: string): Promise<Store[]> => {
const { data } = await api.get("", {
params: {
query: `${town} ๋…ธ๋ž˜๋ฐฉ`,
},
});
return data.documents;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

getLocationBasedSearch ์™€ geStoreBasedTown ํ•จ์ˆ˜๊ฐ€ params ๋ฅผ ์ œ์™ธํ•˜๊ณ  ๋น„์Šทํ•ด๋ณด์ด๋Š”๋ฐ
getQueryParams์–ด์ฉŒ๊ตฌ ๋กœ params ๋ฅผ ์„ ์–ธํ•ด์ฃผ๊ณ  ํ†ตํ•ฉ์‹œ์ผœ์ฃผ๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

๊ทธ๋ ‡๊ฒŒ ๋ฌถ์–ด๋ด์•ผ๊ฒ ๋‹ค ๊ณ ๋งˆ์›Œ!

</StWrapper>
);
}
const StWrapper = styled.div`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์‹œ๋ฉ˜ํ‹ฑ ํƒœ๊ทธ๋„ ํ•จ ๊ณ ๋ คํ•ด๋ณด์‹ฌ์ด ์–ด๋–จ๊นŒ์š”,!

Suggested change
const StWrapper = styled.div`
const StWrapper = styled.main`

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์•—! ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๋ˆˆ์ฐ๋ฏธ์ข‹๋„ค์š”

Comment on lines +69 to +73
}

& > .info__address {
max-width: 150px;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์˜คํ˜ธ ํด๋ž˜์Šค๋ช…์œผ๋กœ ์„ ์–ธํ•ด์ฃผ์‹  ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค

@leeseooo leeseooo Jun 27, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

๋…ธ๋ž˜๋ฐฉ ์นด๋“œ ์•ˆ์˜ ์ •๋ณด ์ค‘์—์„œ ์ œ๋ชฉ ๋นผ๊ณ  ๋‚˜๋จธ์ง€๋ฅผ ๋‹ค pํƒœ๊ทธ๋กœ ํ•ด๋†”์„œ class๋กœ ๊ตฌ๋ถ„ํ–ˆ๋Š”๋ฐ nth-child๋กœ ๋ฐ”๊พธ๋Š”๊ฒŒ ๋” ์ข‹์„๊นŒ์š”?๊ทธ๋•Œ๋Š” nth-child๊ฐ€ ์ƒ๊ฐ์ด ์•ˆ๋‚ฌ์๋‹ˆ๋‹ค ใ…‹ใ…‹ใ…‹

+) ๊ทธ๋ƒฅ ์Šค์ปดํฌ๋„ŒํŠธ๋กœ ๋งŒ๋“œ๋Š”๊ฒŒ ๋‚ซ๊ฒ ๋‹ค๊ณ  ์ƒ๊ฐ์ด ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SC ๋งŒ๋“ค๊ธฐ ์˜ค์ผ€์ด ~~~~


return (
<StCard>
<a href={place_url || undefined}>{place_name}</a>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined ์˜ต์…”๋„์„ ๋ถ™์—ฌ์ค€ ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค !!

Suggested change
<a href={place_url || undefined}>{place_name}</a>
<a href={place_url}>{place_name}</a>

API ์— place_url ์ด ์—†๋Š” ๊ฒƒ ๋–„๋ฌธ์ด๋ผ๋ฉด ์•„๋ž˜์ฒ˜๋Ÿผ ์ž‘์„ฑํ•˜๋Š” ๊ฒŒ ๋” ๋ช…์‹œ์ ์ด์ง€ ์•Š์„๊นŒ ํ•ฉ๋‹ˆ๋‹ค! (css ์ฝ”๋“œ๊ฐ€ ์กฐ๊ธˆ ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”,!)

Suggested change
<a href={place_url || undefined}>{place_name}</a>
{place_url && <a href={place_url}>{place_name}</a>}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ํ™•์ธํ•ด๋ณด๋‹ˆ๊นŒ ๋ถˆํ•„์š”ํ•œ ๋ถ€๋ถ„์ด๋„ค์š”... ๊ผผ๊ผผํ•˜์ง€ ๋ชปํ–ˆ๋„ค์š”
๋งŒ์•ฝ ํ•ด๋‹น ๋ฐ์ดํ„ฐ๋ฅผ ์ค„ ์ˆ˜๋„ ์žˆ๊ณ  ์•ˆ ์ค„์ˆ˜๋„ ์žˆ๋Š” ๊ฒฝ์šฐ๋ผ๋ฉด ์ขœ๋‹˜์ด ๋ฐ‘์— ์จ์ฃผ์‹  ์ฝ”๋“œ๋กœ ์ž‘์„ฑํ•˜๋„๋ก ํ• ๊ฒŒ์š”!๐Ÿ‘

Comment on lines +28 to +31
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์—ฌ๊ธด id ์†์„ฑ์ด ๋น ์ง„ ๊ฒƒ ๊ฐ™๋„ค์š”??

Suggested change
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."
<label htmlFor="text">์šฐ๋ฆฌ ๋™๋„ค๋Š” ์—ฌ๊ธฐ์—์š”</label>
<input
type="text"
id="text"
placeholder="์ง€์—ญ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์‹œ๋ ฅ 3.0์ด์„ธ์š”??

Comment on lines +11 to +17
export default function ResultSection({
storeInfo,
isCheck,
isLoading,
}: ResultSectionProps) {
return (
<>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

์ปจ๋ฒค์…˜ ์ฐจ์ด์ด์ง€๋งŒ, ์•„๋ž˜์ฒ˜๋Ÿผ ์„ ์–ธํ•˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค! ๊ฐ€๋…์„ฑ์ด ์ข‹๋‹ค๋Š” ์˜๊ฒฌ์ด ์žˆ๋˜ ๊ฒƒ ๊ฐ™์•„์š”,, ๋Š” ์ฃผํ•จ

Suggested change
export default function ResultSection({
storeInfo,
isCheck,
isLoading,
}: ResultSectionProps) {
return (
<>
export default function ResultSection(props: ResultSectionProps) {
const {storeInfo, isCheck, isLoading} = props
return (
<>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

์˜ค..ํ›จ์”ฌ ๋ณด๊ธฐ ํŽธํ•˜๋„ค์š” ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

@joohaem joohaem left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Nahee-Park

๋‹ค๋ฅธ ์–ธ์–ด๋“ค๊ณผ๋Š” ๋‹ฌ๋ฆฌ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋Š” ํƒ€์ž… ์ถ”๋ก ์ด ๋˜๋„๋ก ์œ ๋„ํ•˜๊ณ , ํƒ€์ž…์ด ์ถ”๋ก ๋˜๋Š” ๊ฒฝ์šฐ ๊ตณ์ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์ฃผ์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ปจ๋ฒค์…˜์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ €๋„ ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด ๋ช…ํ™•ํ•˜๊ฒŒ ์™œ ๊ทธ๋ ‡๊ฒŒ ํ•˜๋Š” ์ง€ ์ด์œ ๋ฅผ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.

์ €๋„ ๊ถ๊ธˆํ•ด์„œ ์—ฌ๊ธฐ์ €๊ธฐ ์ฐพ์•„๋ดค๋Š”๋ฐ,
๋‹ค๋ฅธ ์–ธ์–ด๋“ค๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ๋ฉ”๋ชจ๋ฆฌ ์˜์—ญ์„ ์œ„ํ•ด ํƒ€์ž… ์ง€์ •์ด ํ•„์ˆ˜์ ์ด๋ฏ€๋กœ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ •ํ•ด์ฃผ๋Š” ๊ฒƒ ๊ฐ™๊ณ 
์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์™€ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋Š” ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ๋ฐฉ์‹์ด ๋‹ค๋ฅด๋ฏ€๋กœ ์ƒ๊ธด ์ปจ๋ฒค์…˜ ์ฐจ์ด๊ฐ€ ์•„๋‹๊นŒ ํ•ฉ๋‹ˆ๋‹ค!

๋ช…์‹œ์ ์œผ๋กœ๋‚˜ ์•”์‹œ์ ์œผ๋กœ๋‚˜ ํƒ€์ž… ๋ถ€์—ฌํ•ด์ฃผ๋Š” ๋ฐฉ์‹ ๋‘˜ ๋‹ค ์žฅ๋‹จ์ ์ด ์žˆ์œผ๋‹ˆ ๋ชฉ์ ์— ๋”ฐ๋ผ ์œ ์—ฐํ•˜๊ฒŒ ์“ฐ๋Š” ๊ฒŒ ๋งž๋Š” ๊ฒƒ ๊ฐ™์•„์š”
์ด๋ฅผ ์œ„ํ•ด ๋ช…์‹œ์  ํƒ€์ž… ์ง€์ •์„ ์œ„ํ•œ ๋ฆฐํŠธ์™€ ์•”์‹œ์  ํƒ€์ž… ์ง€์ •์„ ์œ„ํ•œ ๋ฆฐํŠธ๋“ค์ด ๋„๊ตฌ๋กœ์จ ์žˆ๋Š” ๊ฒƒ ๊ฐ™๊ธฐ๋„ ํ•˜๋„ค์š”!!

์ฐธ๊ณ  ์•„ํ‹ฐํด (๋งํฌ)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4๏ธโƒฃ 4์ฃผ์ฐจ 4์ฃผ์ฐจ ๊ณผ์ œ์—์š”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants