-
Notifications
You must be signed in to change notification settings - Fork 4
✨ feat: Show Apartment Details on Result Page #50
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,20 @@ | ||
| import React from 'react'; | ||
|
|
||
| export default function Apartment({ apartments }) { | ||
| if (!apartments.length) { | ||
| return ( | ||
| <p>loading</p> | ||
| ); | ||
| } | ||
| export default function Apartment({ apartment }) { | ||
| const { | ||
| name, | ||
| district, | ||
| area, | ||
| } = apartment; | ||
|
|
||
| return ( | ||
| <> | ||
| {apartments?.map((apartment) => ( | ||
| <div key={apartment.name}> | ||
| <dl> | ||
| <dd>아파트명:</dd> | ||
| <dt>{apartment.name}</dt> | ||
| <dd>법정동:</dd> | ||
| <dt>{apartment.district}</dt> | ||
| <dd>전용면적:</dd> | ||
| <dt>{apartment.area}</dt> | ||
| </dl> | ||
| </div> | ||
| ))} | ||
| </> | ||
| <dl> | ||
| <dd>아파트명:</dd> | ||
| <dt>{name}</dt> | ||
| <dd>법정동:</dd> | ||
| <dt>{district}</dt> | ||
| <dd>전용면적:</dd> | ||
| <dt>{area}</dt> | ||
| </dl> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import React from 'react'; | ||
|
|
||
| import LinkField from '../../components/LinkField'; | ||
|
|
||
| import Apartment from './Apartment'; | ||
|
|
||
| export default function Apartments({ apartments, onClick, changeApartment }) { | ||
| if (!apartments.length) { | ||
| return ( | ||
| <p>loading</p> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <> | ||
| {apartments?.map((apartment) => ( | ||
| <article key={apartment.name}> | ||
|
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. 아파트 name이 key가 되는건가요? 아파트 이름이 겹치는 케이스는 없을까요? 아니라면 id 프로퍼티를 추가해서 사용해도 좋을 것 같네요 ㅎㅎ
Contributor
Author
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. 아파트 이름이 중복될 가능성은 희박하다. 절대란 없으니, 추후에 백엔드에서 data를 가공할떄, id를 넣어주도록 수정 예정. |
||
| <Apartment apartment={apartment} /> | ||
| <LinkField | ||
| url="/result" | ||
| title="보기" | ||
| onClick={onClick} | ||
| apartment={apartment} | ||
| changeApartment={changeApartment} | ||
| /> | ||
| </article> | ||
| ))} | ||
| </> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
특정 경우에만 changeApartment()가 실행되는건가요?
그럼 title이 보기인 경우에만 사용하는 곳에서 changeApartment를 주입해주고
이 핸들러 함수에서는 changeApartment가 있는 경우에만 호출하도록 처리할 수도 있을 것 같아요.
changeApartment?.(apartment);아니면 props로 onClick을 넘겨주고 있으니 onClick에 title이 보기인 경우에만 핸들링하는 로직을 넣어서 넘기는 방법도 있을 것 같아요.
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.
#42 반영 완료!