Skip to content

Commit 7865f0a

Browse files
committed
fix: fix layout
1 parent 4f1ed77 commit 7865f0a

File tree

5 files changed

+37
-22
lines changed

5 files changed

+37
-22
lines changed

src/components/price/PriceItem.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,33 @@ const Text = styled.div`
2828
white-space: pre-wrap;
2929
3030
&.title {
31-
width: max-content;
31+
width: 100px;
3232
font-size: 24px;
3333
font-weight: 700;
3434
text-align: left;
3535
}
3636
3737
&.increment {
38-
width: max-content;
38+
width: 100px;
3939
font-size: 20px;
4040
font-weight: 800;
4141
color: #8fa86a;
4242
}
4343
4444
&.decrement {
45-
width: max-content;
45+
width: 100px;
4646
font-size: 20px;
4747
font-weight: 800;
4848
color: #d53d3d;
4949
}
5050
5151
&.count {
52+
width: 30px;
5253
color: #000;
5354
text-align: center;
5455
font-size: 20px;
5556
font-weight: 400;
5657
border: 0.8px solid #000;
57-
min-width: 28px;
5858
}
5959
`;
6060

src/components/shopping/ShoppingBudget.jsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ const BudgetInput = styled.input`
9494
}
9595
`;
9696

97-
function ShoppingBudget(props) {
98-
const { budget, present } = props;
97+
function ShoppingBudget({ budget, present, readOnly }) {
9998
const [isEditing, setIsEditing] = useState(false);
10099
const [newBudget, setNewBudget] = useState("");
101100
const state = budget - present;
@@ -170,11 +169,13 @@ function ShoppingBudget(props) {
170169
<FiDollarSign color="#daa520" size={32} />
171170
<Text className="budget">예산</Text>
172171
<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+
)}
178179
</ContentContainer>
179180
{isEditing && (
180181
<BudgetInputContainer>

src/components/shopping/ShoppingList.jsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ListContainer = styled.div`
1212
padding: 20px;
1313
`;
1414

15-
function ShoppingList() {
15+
function ShoppingList({ readOnly }) {
1616
const navigate = useNavigate();
1717
const [items, setItems] = useState([]);
1818
const [isLoading, setIsLoading] = useState(true);
@@ -110,11 +110,14 @@ function ShoppingList() {
110110
return (
111111
<DragDropContext onDragEnd={handleDragEnd}>
112112
<ListContainer>
113-
<ShoppingListItems items={items} onDelete={handleDelete} />
113+
<ShoppingListItems
114+
items={items}
115+
onDelete={readOnly ? null : handleDelete}
116+
/>
114117
<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}
118121
/>
119122
</ListContainer>
120123
</DragDropContext>

src/pages/LandingPage.jsx

+15-4
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ const UserContainer = styled.div`
8282
padding-top: 40px;
8383
`;
8484

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+
8594
const TrendContainer = styled.div`
8695
display: flex;
8796
flex-wrap: wrap;
@@ -198,10 +207,12 @@ function LandingPage() {
198207
장바구니 상품을 관리해보세요!
199208
</SubTitleText>
200209
</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>
205216
<Button
206217
title="장바구니 수정하기"
207218
className="yellow"

src/pages/ShoppingCartPage.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function ShoppingCartPage() {
5353
<MainBar />
5454
<Text className="title">장바구니 관리</Text>
5555
<Text className="sub">수정하고 싶은 상품을 선택하세요</Text>
56-
<ShoppingBudget />
56+
<ShoppingBudget readOnly={false} />
5757
<Wrapper>
58-
<ShoppingList />
58+
<ShoppingList readOnly={false} />
5959
</Wrapper>
6060
</Container>
6161
);

0 commit comments

Comments
 (0)