Skip to content

Commit dcc97df

Browse files
committed
feat: 전체 페이지 라우팅 연결
1 parent 06f916b commit dcc97df

File tree

13 files changed

+112
-43
lines changed

13 files changed

+112
-43
lines changed

src/pages/CreateReviewLoadingPage/CreateReviewLoadingPage.module.scss renamed to src/components/CreateReviewLoading/CreateReviewLoading.module.scss

File renamed without changes.

src/pages/CreateReviewLoadingPage/CreateReviewLoadingPage.tsx renamed to src/components/CreateReviewLoading/CreateReviewLoading.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
import styles from "@/components/CreateReviewLoading/CreateReviewLoading.module.scss";
12
import Text from "@/components/ui/Text/Text";
23

3-
import styles from "@/pages/CreateReviewLoadingPage/CreateReviewLoadingPage.module.scss";
4-
5-
const CreateReviewLoadingPage = () => {
4+
const CreateReviewLoading = () => {
65
return (
76
<div className={styles.CreateReviewLoading}>
87
<div className={styles.Title}>
@@ -21,4 +20,4 @@ const CreateReviewLoadingPage = () => {
2120
);
2221
};
2322

24-
export default CreateReviewLoadingPage;
23+
export default CreateReviewLoading;

src/components/Home/Home.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
import { useNavigate } from "react-router-dom";
2+
13
import styles from "@/components/Home/Home.module.scss";
24
import IconButton from "@/components/ui/IconButton/IconButton";
35
import Text from "@/components/ui/Text/Text";
46

7+
import { PATH } from "@/constants/path";
8+
59
const Home = () => {
10+
const navigate = useNavigate();
11+
12+
const handleCameraButtonClick = () => {
13+
navigate(PATH.RECEIPT_EDIT);
14+
};
15+
616
return (
717
<div className={styles.Home}>
818
<div className={styles.HomeTitle}>
@@ -18,7 +28,7 @@ const Home = () => {
1828
</div>
1929
<div className={styles.HomeBottom}>
2030
<IconButton text="갤러리" iconName="gallery" />
21-
<IconButton text="카메라" iconName="camera" />
31+
<IconButton text="카메라" iconName="camera" onClick={handleCameraButtonClick} />
2232
</div>
2333
</div>
2434
);

src/components/HomeNavigateConfirmModal/HomeNavigateConfirmModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Icon from "@/components/ui/Icon/Icon";
99
import Modal from "@/components/ui/Modal/Modal";
1010
import Text from "@/components/ui/Text/Text";
1111

12+
import { PATH } from "@/constants/path";
13+
1214
interface HomeNavigateConfirmModalProps {
1315
isOpen: boolean;
1416
handleClose: () => void;
@@ -26,7 +28,7 @@ const HomeNavigateConfirmModal = ({ isOpen, handleClose }: HomeNavigateConfirmMo
2628

2729
const handleNavigateHome = () => {
2830
handleClose();
29-
navigate("/");
31+
navigate(PATH.HOME);
3032
};
3133

3234
return (

src/components/ReceiptEdit/ReceiptEdit.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import { useState } from "react";
2+
import { useNavigate } from "react-router-dom";
23

34
import styles from "@/components/ReceiptEdit/ReceiptEdit.module.scss";
45
import Button from "@/components/ui/Button/Button";
56
import Input from "@/components/ui/Input/Input";
67
import Text from "@/components/ui/Text/Text";
78

9+
import { PATH } from "@/constants/path";
10+
811
import { useFocus } from "@/hooks/common/useFocus";
912

1013
const ReceiptEdit = () => {
14+
const navigate = useNavigate();
15+
1116
const [placeName, setPlaceName] = useState("청담커피 앤 토스트");
1217
const [foodName, setFoodName] = useState("카야토스트+음료세트");
1318

@@ -18,6 +23,10 @@ const ReceiptEdit = () => {
1823
} = useFocus({});
1924
const { isFocus: isFoodFocus, onFocus: handleFoodFocus, onBlur: handleFoodBlur } = useFocus({});
2025

26+
const handleInfoRightButtonClick = () => {
27+
navigate(PATH.SELECT_TAG);
28+
};
29+
2130
return (
2231
<div className={styles.ReceiptEdit}>
2332
<div className={styles.Top}>
@@ -69,7 +78,11 @@ const ReceiptEdit = () => {
6978
) : (
7079
<>
7180
<Button text="다시 스캔하기" variant="secondary" />
72-
<Button text="정보가 맞아요" disabled={!placeName || !foodName} />
81+
<Button
82+
text="정보가 맞아요"
83+
disabled={!placeName || !foodName}
84+
onClick={handleInfoRightButtonClick}
85+
/>
7386
</>
7487
)}
7588
</div>

src/components/ReceiptResult/ReceiptResult.module.scss renamed to src/components/ReviewResult/ReviewResult.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ReceiptResult {
1+
.ReviewResult {
22
padding: 1.25rem;
33
padding-bottom: 2.5rem;
44
height: calc(100vh - 2.75rem);

src/components/ReceiptResult/ReceiptResult.tsx renamed to src/components/ReviewResult/ReviewResult.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useEffect } from "react";
33
import confetti from "canvas-confetti";
44

55
import HomeNavigateConfirmModal from "@/components/HomeNavigateConfirmModal/HomeNavigateConfirmModal";
6-
import styles from "@/components/ReceiptResult/ReceiptResult.module.scss";
6+
import styles from "@/components/ReviewResult/ReviewResult.module.scss";
77
import Button from "@/components/ui/Button/Button";
88
import IconButton from "@/components/ui/IconButton/IconButton";
99
import Text from "@/components/ui/Text/Text";
@@ -12,7 +12,7 @@ import { useOverlay } from "@/hooks/common/useOverlay";
1212

1313
import type { Options as ConfettiOptions } from "canvas-confetti";
1414

15-
const ReceiptResult = () => {
15+
const ReviewResult = () => {
1616
const { isOpen, handleClose, handleOpen } = useOverlay();
1717

1818
const handleConfetti = () => {
@@ -34,7 +34,7 @@ const ReceiptResult = () => {
3434
}, []);
3535

3636
return (
37-
<div className={styles.ReceiptResult}>
37+
<div className={styles.ReviewResult}>
3838
<div className={styles.Top}>
3939
<div className={styles.ReceiptImage}>
4040
<img src="/assets/img/img-style-cute-circle.png" alt="mainLogo" />
@@ -64,4 +64,4 @@ const ReceiptResult = () => {
6464
);
6565
};
6666

67-
export default ReceiptResult;
67+
export default ReviewResult;

src/components/SelectStyle/SelectStyle.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useState } from "react";
2+
import { useNavigate } from "react-router-dom";
23

34
import classNames from "classnames";
45

@@ -7,6 +8,8 @@ import Button from "@/components/ui/Button/Button";
78
import Icon from "@/components/ui/Icon/Icon";
89
import Text from "@/components/ui/Text/Text";
910

11+
import { PATH } from "@/constants/path";
12+
1013
interface StyleProps {
1114
name: string;
1215
image: string;
@@ -20,12 +23,18 @@ const IMG_STYLE_DATA = [
2023
];
2124

2225
const SelectStyle = () => {
26+
const navigate = useNavigate();
27+
2328
const [selectedStyle, setSelectedStyle] = useState(IMG_STYLE_DATA[0]);
2429

2530
const handleStyleClick = (style: StyleProps) => {
2631
setSelectedStyle((prevStyle) => (prevStyle.name === style.name ? IMG_STYLE_DATA[0] : style));
2732
};
2833

34+
const handleCreateReviewButtonClick = () => {
35+
navigate(PATH.REVIEW_RESULT);
36+
};
37+
2938
return (
3039
<div className={styles.SelectStyle}>
3140
<div className={styles.Title}>
@@ -59,7 +68,7 @@ const SelectStyle = () => {
5968
</div>
6069

6170
<div className={styles.Bottom}>
62-
<Button text="리뷰 만들기" />
71+
<Button text="리뷰 만들기" onClick={handleCreateReviewButtonClick} />
6372
</div>
6473
</div>
6574
);

src/components/SelectTag/SelectTag.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { useState } from "react";
2+
import { useNavigate } from "react-router-dom";
23

34
import styles from "@/components/SelectTag/SelectTag.module.scss";
45
import TagSheet from "@/components/SelectTag/TagSheet/TagSheet";
56
import Button from "@/components/ui/Button/Button";
67
import Tag from "@/components/ui/Tag/Tag";
78
import Text from "@/components/ui/Text/Text";
89

10+
import { PATH } from "@/constants/path";
11+
912
// 임시 데이터
1013
const TAG_LIST = [
1114
"음식이 맛있어요",
@@ -22,6 +25,8 @@ const TAG_LIST = [
2225
];
2326

2427
const SelectTag = () => {
28+
const navigate = useNavigate();
29+
2530
const [selectedTagList, setSelectedTagList] = useState<string[]>([]);
2631
const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false);
2732

@@ -39,6 +44,10 @@ const SelectTag = () => {
3944
setIsBottomSheetOpen(false);
4045
};
4146

47+
const handleNextButtonClick = () => {
48+
navigate(PATH.SELECT_STYLE);
49+
};
50+
4251
return (
4352
<div className={styles.SelectTag}>
4453
<div className={styles.Top}>
@@ -64,7 +73,7 @@ const SelectTag = () => {
6473
</div>
6574

6675
<div className={styles.Bottom}>
67-
<Button text="다음" />
76+
<Button text="다음" onClick={handleNextButtonClick} />
6877
</div>
6978

7079
<TagSheet isOpen={isBottomSheetOpen} handleClose={handleSheetClose} />

src/constants/path.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const PATH = {
2+
HOME: "/",
3+
RECOGNITION_FAIL: "/recognition-fail",
4+
RECEIPT_EDIT: "/receipt-edit",
5+
SELECT_TAG: "/select-tag",
6+
SELECT_STYLE: "/select-style",
7+
REVIEW_RESULT: "/review-result",
8+
};

0 commit comments

Comments
 (0)