Skip to content

Commit

Permalink
Merge pull request #92 from SOPT-all/feat/#89/petGenderView
Browse files Browse the repository at this point in the history
[Feat/#89] ๋ฐ˜๋ ค๋™๋ฌผ ์„ฑ๋ณ„ ๋ทฐ
  • Loading branch information
yarimu authored Jan 17, 2025
2 parents 381dad2 + a4d6dd1 commit 041050d
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/page/onboarding/index/component/petGender/PetGender.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { style } from "@vanilla-extract/css";

export const layout = style({
display: "flex",
flexDirection: "column",
padding: "8rem 2rem",
gap: "9rem",
});

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",
});
49 changes: 49 additions & 0 deletions src/page/onboarding/index/component/petGender/PetGender.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as styles from "./PetGender.css";
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 DualOptionSelector from "../dualOptionSelector/DualOptionSelector";
import { Button } from "@common/component/Button";
import { data } from "@page/onboarding/index/constant/genderData";
import { useState } from "react";

const PetGender = () => {
// ์„ ํƒ ์ƒํƒœ ๊ด€๋ฆฌ (์ดˆ๊ธฐ๊ฐ’: null)
const [gender, setGender] = useState<string | null>(null);

// ์„ ํƒํ•œ ๋ฒ„ํŠผ ํ…์ŠคํŠธ = selectedPetType
const handleOptionSelect = (value: string) => {
setGender(value);
};
// ๋’ค๋กœ ๊ฐ€๊ธฐ
const navigate = useNavigate();
const handleGoBack = () => {
navigate(-1);
};

// ๋‹ค์Œ ๋ฒ„ํŠผ
const handleNext = () => {
console.log("๋‹ค์Œ pr์—์„œ ๊ตฌํ˜„ํ• ๋ž˜์šฅ.");
};
return (
<>
{/* ์ƒ๋‹จ ์˜์—ญ */}
<div className={styles.layout}>
<div>
<Title text={ONBOARDING_GUIDE.petGender.title} />
<Docs text={ONBOARDING_GUIDE.petGender.docs} />
</div>
{/* ์„ฑ๋ณ„ ์„ ํƒ ์˜์—ญ */}
<DualOptionSelector data={data.gender} onSelect={handleOptionSelect} />
</div>
{/* ํ•˜๋‹จ ์˜์—ญ */}
<div className={styles.btnWrapper}>
<Button label="๋Œ์•„๊ฐ€๊ธฐ" size="large" variant="solidNeutral" disabled={false} onClick={handleGoBack} />
<Button label="๋‹ค์Œ" size="large" variant="solidPrimary" disabled={!gender} onClick={handleNext} />
</div>
</>
);
};

export default PetGender;
17 changes: 17 additions & 0 deletions src/page/onboarding/index/constant/genderData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import selectImg from "@asset/image/image 1733.png";

// ์—ฌ๊ธฐ๋Š” api ์—ฐ๊ฒฐ ์•„๋‹ˆ๋‚˜, api์—ฐ๊ฒฐ๋ทฐ์™€ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๊ณต์œ ํ•ด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๊ตฌํ˜„
export const data = {
gender: [
{
id: 1,
label: "์•”์ปท",
image: selectImg,
},
{
id: 2,
label: "์ˆ˜์ปท",
image: selectImg,
},
],
};

0 comments on commit 041050d

Please sign in to comment.