|
1 | 1 | import { useEffect, useState } from "react"; |
2 | 2 |
|
3 | | -import styles from "@/components/ReceiptEdit/ReceiptEdit.module.scss"; |
| 3 | +import Navbar from "@/components/common/Navbar/Navbar"; |
4 | 4 | import Button from "@/components/ui/Button/Button"; |
| 5 | +import Icon from "@/components/ui/Icon/Icon"; |
5 | 6 | import Input from "@/components/ui/Input/Input"; |
6 | 7 | import Text from "@/components/ui/Text/Text"; |
7 | 8 |
|
8 | 9 | import { useRoute } from "@/hooks/common/useRoute"; |
9 | 10 |
|
| 11 | +import styles from "@/pages/ReceiptEditPage/ReceiptEditPage.module.scss"; |
| 12 | + |
10 | 13 | import { useCreateReviewStore } from "@/store/useReviewStore"; |
11 | 14 | import { useScanDataStore } from "@/store/useScanDataStore"; |
12 | 15 |
|
13 | | -const ReceiptEdit = () => { |
| 16 | +const ReceiptEditPage = () => { |
14 | 17 | const { navigateToHome, navigateToSelectTag } = useRoute(); |
15 | 18 |
|
16 | 19 | const { scanData, resetScanData } = useScanDataStore(); |
@@ -74,37 +77,50 @@ const ReceiptEdit = () => { |
74 | 77 | navigateToHome(); |
75 | 78 | }; |
76 | 79 |
|
| 80 | + const handleNavigateToHome = () => { |
| 81 | + resetScanData(); |
| 82 | + navigateToHome(); |
| 83 | + }; |
| 84 | + |
77 | 85 | return ( |
78 | 86 | <div className={styles.ReceiptEdit}> |
79 | | - <div className={styles.Top}> |
80 | | - <div className={styles.TitleBox}> |
81 | | - <Text variant="titleM" color="primary" as="h1" truncated> |
82 | | - {formData.length > 0 && Object.keys(formData[0]).length > 0 && formData[0].value} |
83 | | - </Text> |
84 | | - <Text variant="titleM" color="primary" as="h1"> |
85 | | - 에 |
| 87 | + <div className={styles.Container}> |
| 88 | + <Navbar className={styles.Navbar}> |
| 89 | + <Navbar.LeftButton onClick={handleNavigateToHome}> |
| 90 | + <Icon name="leftArrow" /> |
| 91 | + </Navbar.LeftButton> |
| 92 | + </Navbar> |
| 93 | + |
| 94 | + <div className={styles.Top}> |
| 95 | + <div className={styles.TitleBox}> |
| 96 | + <Text variant="titleM" color="primary" as="h1" truncated> |
| 97 | + {formData.length > 0 && Object.keys(formData[0]).length > 0 && formData[0].value} |
| 98 | + </Text> |
| 99 | + <Text variant="titleM" color="primary" as="h1"> |
| 100 | + 에 |
| 101 | + </Text> |
| 102 | + </div> |
| 103 | + <Text variant="titleM" color="primary" as="h1" align="center"> |
| 104 | + 다녀오셨네요! |
86 | 105 | </Text> |
87 | | - </div> |
88 | | - <Text variant="titleM" color="primary" as="h1" align="center"> |
89 | | - 다녀오셨네요! |
90 | | - </Text> |
91 | | - |
92 | | - <div className={styles.InfoList}> |
93 | | - {formData.map((data, index) => ( |
94 | | - <div key={index} className={styles.InfoItem}> |
95 | | - <Text variant="bodyXsm" color="secondary"> |
96 | | - {data.key} |
97 | | - </Text> |
98 | | - <Input |
99 | | - placeholder={`${data.key} 입력`} |
100 | | - value={data.value} |
101 | | - onFocus={() => handleFocus(index.toString())} |
102 | | - onBlur={() => handleBlur(index.toString())} |
103 | | - isFocus={focusState[index.toString()] || false} |
104 | | - onChange={(e) => handleInputChange(index, e.target.value)} |
105 | | - /> |
106 | | - </div> |
107 | | - ))} |
| 106 | + |
| 107 | + <div className={styles.InfoList}> |
| 108 | + {formData.map((data, index) => ( |
| 109 | + <div key={index} className={styles.InfoItem}> |
| 110 | + <Text variant="bodyXsm" color="secondary"> |
| 111 | + {data.key} |
| 112 | + </Text> |
| 113 | + <Input |
| 114 | + placeholder={`${data.key} 입력`} |
| 115 | + value={data.value} |
| 116 | + onFocus={() => handleFocus(index.toString())} |
| 117 | + onBlur={() => handleBlur(index.toString())} |
| 118 | + isFocus={focusState[index.toString()] || false} |
| 119 | + onChange={(e) => handleInputChange(index, e.target.value)} |
| 120 | + /> |
| 121 | + </div> |
| 122 | + ))} |
| 123 | + </div> |
108 | 124 | </div> |
109 | 125 | </div> |
110 | 126 |
|
@@ -136,4 +152,4 @@ const ReceiptEdit = () => { |
136 | 152 | ); |
137 | 153 | }; |
138 | 154 |
|
139 | | -export default ReceiptEdit; |
| 155 | +export default ReceiptEditPage; |
0 commit comments