-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Feat/#71] 반려동물 질병 유무 뷰 구현 #79
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f2d6590
feat: 반려동물 질병 선택 뷰 퍼블리싱
yarimu f05de49
fix: 버튼 레이아웃 조정
yarimu 929118c
fix: button 컴포넌트 active css 수정 (민정커밋)
yarimu 93668b9
feat: 하단 버튼 활성화
yarimu daa4b4a
feat: 질병유무부터 자식 컴포넌트 로직 연결
yarimu 9b05e64
fix: conflict 해결
yarimu 02800a5
Merge branch 'develop' into feat/#71/PetHealthDualSelector
yarimu 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 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 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,9 +1,6 @@ | ||
|
||
const Onboarding = () => { | ||
return ( | ||
<> | ||
</> | ||
); | ||
return <></>; | ||
}; | ||
|
||
export default Onboarding; | ||
|
24 changes: 24 additions & 0 deletions
24
src/page/onboarding/index/component/petHealth/PetHealth.tsx
This file contains 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,24 @@ | ||
import { useState } from "react"; | ||
import PetHealthDualSelector from "@page/onboarding/index/component/petHealth/petHealthDualSelector/PetHealthDualSelector"; | ||
import Disease from "./disease/Disease"; | ||
import Symptom from "./symptom/Symptom"; | ||
|
||
const PetHealth = () => { | ||
// 제출 할 폼 정보 저장 로직은 PetHealth 하위 컴포넌트 퍼블리싱 완료 후 구현 예정 | ||
const [healthStep, setHealthStep] = useState<string>(""); | ||
|
||
// healthStep 상태를 업데이트하는 핸들러 | ||
const stepChange = (step: string) => { | ||
setHealthStep(step); | ||
}; | ||
|
||
return ( | ||
<> | ||
{healthStep === "" && <PetHealthDualSelector stepChange={stepChange} />} | ||
{healthStep === "예" && <Disease />} | ||
{healthStep === "아니오" && <Symptom />} | ||
</> | ||
); | ||
}; | ||
|
||
export default PetHealth; |
10 changes: 10 additions & 0 deletions
10
src/page/onboarding/index/component/petHealth/disease/Disease.tsx
This file contains 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,10 @@ | ||
|
||
const Disease = () => { | ||
return ( | ||
<div> | ||
질병뷰 | ||
</div> | ||
) | ||
} | ||
|
||
export default Disease |
26 changes: 26 additions & 0 deletions
26
...e/onboarding/index/component/petHealth/petHealthDualSelector/PetHealthDualSelector.css.ts
This file contains 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,26 @@ | ||
import { style } from "@vanilla-extract/css"; | ||
|
||
export const layout = style({ | ||
display: "flex", | ||
flexDirection: "column", | ||
padding: "8rem 2rem", | ||
gap: "9rem", | ||
}); | ||
export const dualSelectorWrapper = style({ | ||
display: "grid", | ||
gridTemplateColumns: "1fr 1fr", | ||
gap: "1.2rem", | ||
}); | ||
|
||
export const btnWrapper = style({ | ||
maxWidth: "76.8rem", | ||
width: "100%", | ||
position: "fixed", | ||
bottom: 0, | ||
|
||
display: "grid", | ||
gridTemplateColumns: "9.6rem calc(100% - 10.8rem)", | ||
gap: "1.2rem", | ||
whiteSpace: "nowrap", | ||
padding: "1.2rem 2rem 3.2rem 2rem", | ||
}); |
58 changes: 58 additions & 0 deletions
58
...page/onboarding/index/component/petHealth/petHealthDualSelector/PetHealthDualSelector.tsx
This file contains 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,58 @@ | ||
import * as styles from "./PetHealthDualSelector.css"; | ||
import { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { ONBOARDING_GUIDE } from "@page/onboarding/index/constant/onboardingGuide"; | ||
|
||
import Title from "@page/onboarding/index/common/title/Title"; | ||
import Docs from "@page/onboarding/index/common/docs/Docs"; | ||
import { Button } from "@common/component/Button"; | ||
|
||
interface PetHealthDualSelectorProps { | ||
stepChange: (step: string) => void; | ||
} | ||
|
||
const PetHealthDualSelector = ({ stepChange }: PetHealthDualSelectorProps) => { | ||
const [selected, setSelected] = useState<string | null>(null); | ||
|
||
// 선택한 값 처리 | ||
const handleSelect = (choice: string) => { | ||
setSelected(choice); | ||
}; | ||
|
||
// 뒤로 가기 | ||
const navigate = useNavigate(); | ||
const handleGoBack = () => { | ||
navigate(-1); | ||
yarimu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
// 다음 버튼 (부모로 선택값을 전달_예 or 아니오) | ||
const handleNext = () => { | ||
if (selected) { | ||
stepChange(selected); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{/* 상단 영역 */} | ||
<div className={styles.layout}> | ||
<div> | ||
<Title text={ONBOARDING_GUIDE.isPetDisease.title} /> | ||
<Docs text={ONBOARDING_GUIDE.isPetDisease.docs} /> | ||
</div> | ||
{/* 질병 유무 선택 영역 */} | ||
<div className={styles.dualSelectorWrapper}> | ||
<Button label="아니오" size="large" variant="outlinePrimary" onClick={() => handleSelect("아니오")} /> | ||
<Button label="예" size="large" variant="outlinePrimary" onClick={() => handleSelect("예")} /> | ||
</div> | ||
</div> | ||
{/* 하단 영역 */} | ||
<div className={styles.btnWrapper}> | ||
<Button label="돌아가기" size="large" variant="solidNeutral" onClick={handleGoBack} /> | ||
<Button label="다음" size="large" variant="solidPrimary" disabled={selected === null} onClick={handleNext} /> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default PetHealthDualSelector; |
5 changes: 5 additions & 0 deletions
5
src/page/onboarding/index/component/petHealth/symptom/Symptom.tsx
This file contains 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,5 @@ | ||
const Symptom = () => { | ||
return <div>증상 뷰</div>; | ||
}; | ||
|
||
export default Symptom; |
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.
p4) 짜기 나름이긴 한데, 이거 함수로 따로 빼서, switch 문으로 return 하는 것도 좋은 방법일 것 같아요 ~~
예를 들면 이렇게 입니다
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.
평소 return문 내부가 깔끔한걸 더 선호하는데 이 방법이 더 깔끔하고 좋은거 같아요!!
이렇게 반영해보도록 하겠습니다! 알려주셔서 감사해요❤️
➡️ 조립해서 렌더링 최종 구현할 때 활용해보겠습니다!