File tree 5 files changed +37
-22
lines changed
5 files changed +37
-22
lines changed Original file line number Diff line number Diff line change @@ -28,33 +28,33 @@ const Text = styled.div`
28
28
white-space: pre-wrap;
29
29
30
30
&.title {
31
- width: max-content ;
31
+ width: 100px ;
32
32
font-size: 24px;
33
33
font-weight: 700;
34
34
text-align: left;
35
35
}
36
36
37
37
&.increment {
38
- width: max-content ;
38
+ width: 100px ;
39
39
font-size: 20px;
40
40
font-weight: 800;
41
41
color: #8fa86a;
42
42
}
43
43
44
44
&.decrement {
45
- width: max-content ;
45
+ width: 100px ;
46
46
font-size: 20px;
47
47
font-weight: 800;
48
48
color: #d53d3d;
49
49
}
50
50
51
51
&.count {
52
+ width: 30px;
52
53
color: #000;
53
54
text-align: center;
54
55
font-size: 20px;
55
56
font-weight: 400;
56
57
border: 0.8px solid #000;
57
- min-width: 28px;
58
58
}
59
59
` ;
60
60
Original file line number Diff line number Diff line change @@ -94,8 +94,7 @@ const BudgetInput = styled.input`
94
94
}
95
95
` ;
96
96
97
- function ShoppingBudget ( props ) {
98
- const { budget, present } = props ;
97
+ function ShoppingBudget ( { budget, present, readOnly } ) {
99
98
const [ isEditing , setIsEditing ] = useState ( false ) ;
100
99
const [ newBudget , setNewBudget ] = useState ( "" ) ;
101
100
const state = budget - present ;
@@ -170,11 +169,13 @@ function ShoppingBudget(props) {
170
169
< FiDollarSign color = "#daa520" size = { 32 } />
171
170
< Text className = "budget" > 예산</ Text >
172
171
< Text className = "money" > { `${ budget } ` } ₩</ Text >
173
- < Button
174
- title = "수정"
175
- className = "green"
176
- onClick = { ( ) => setIsEditing ( true ) }
177
- />
172
+ { ! readOnly && (
173
+ < Button
174
+ title = "수정"
175
+ className = "green"
176
+ onClick = { ( ) => setIsEditing ( true ) }
177
+ />
178
+ ) }
178
179
</ ContentContainer >
179
180
{ isEditing && (
180
181
< BudgetInputContainer >
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const ListContainer = styled.div`
12
12
padding: 20px;
13
13
` ;
14
14
15
- function ShoppingList ( ) {
15
+ function ShoppingList ( { readOnly } ) {
16
16
const navigate = useNavigate ( ) ;
17
17
const [ items , setItems ] = useState ( [ ] ) ;
18
18
const [ isLoading , setIsLoading ] = useState ( true ) ;
@@ -110,11 +110,14 @@ function ShoppingList() {
110
110
return (
111
111
< DragDropContext onDragEnd = { handleDragEnd } >
112
112
< ListContainer >
113
- < ShoppingListItems items = { items } onDelete = { handleDelete } />
113
+ < ShoppingListItems
114
+ items = { items }
115
+ onDelete = { readOnly ? null : handleDelete }
116
+ />
114
117
< ShoppingListButtons
115
- onSave = { handleSave }
116
- onAddNew = { handleAddNew }
117
- onDeleteLowest = { handleDeleteLowest }
118
+ onSave = { readOnly ? null : handleSave }
119
+ onAddNew = { readOnly ? null : handleAddNew }
120
+ onDeleteLowest = { readOnly ? null : handleDeleteLowest }
118
121
/>
119
122
</ ListContainer >
120
123
</ DragDropContext >
Original file line number Diff line number Diff line change @@ -82,6 +82,15 @@ const UserContainer = styled.div`
82
82
padding-top: 40px;
83
83
` ;
84
84
85
+ const ShoppingContainer = styled . div `
86
+ min-height: 180px;
87
+ display: flex;
88
+ flex-direction: column;
89
+ justify-content: center;
90
+ padding-right: 95px;
91
+ padding-top: 20px;
92
+ ` ;
93
+
85
94
const TrendContainer = styled . div `
86
95
display: flex;
87
96
flex-wrap: wrap;
@@ -198,10 +207,12 @@ function LandingPage() {
198
207
장바구니 상품을 관리해보세요!
199
208
</ SubTitleText >
200
209
</ TextContainer >
201
- < ShoppingBudget />
202
- < Wrapper >
203
- < ShoppingList />
204
- </ Wrapper >
210
+ < ShoppingContainer >
211
+ < ShoppingBudget readOnly = { true } />
212
+ < Wrapper >
213
+ < ShoppingList readOnly = { true } />
214
+ </ Wrapper >
215
+ </ ShoppingContainer >
205
216
< Button
206
217
title = "장바구니 수정하기"
207
218
className = "yellow"
Original file line number Diff line number Diff line change @@ -53,9 +53,9 @@ function ShoppingCartPage() {
53
53
< MainBar />
54
54
< Text className = "title" > 장바구니 관리</ Text >
55
55
< Text className = "sub" > 수정하고 싶은 상품을 선택하세요</ Text >
56
- < ShoppingBudget />
56
+ < ShoppingBudget readOnly = { false } />
57
57
< Wrapper >
58
- < ShoppingList />
58
+ < ShoppingList readOnly = { false } />
59
59
</ Wrapper >
60
60
</ Container >
61
61
) ;
You can’t perform that action at this time.
0 commit comments