Skip to content

Commit

Permalink
Finished making the Cart page responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlotteLaw committed Apr 8, 2024
1 parent 1516834 commit ff96097
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 61 deletions.
12 changes: 10 additions & 2 deletions src/app/cart/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ export default function Buttons(props: {
return (
<ButtonsWrapper>
<QuantityButton>
<PlusMinusButton type="button" style={{ cursor: 'pointer' }} onClick={decreaseQuantity}>
<PlusMinusButton
type="button"
style={{ cursor: 'pointer' }}
onClick={decreaseQuantity}
>
</PlusMinusButton>
<span>{count}</span>
<PlusMinusButton type="button" style={{ cursor: 'pointer' }} onClick={increaseQuantity}>
<PlusMinusButton
type="button"
style={{ cursor: 'pointer' }}
onClick={increaseQuantity}
>
+
</PlusMinusButton>
</QuantityButton>
Expand Down
13 changes: 7 additions & 6 deletions src/app/cart/cartItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TransparentButton,
Label,
LabelBox,
ImageDiv
ImageDiv,
} from './styles';

import Buttons from './Buttons';
Expand Down Expand Up @@ -40,11 +40,12 @@ export default function CartItem(props: {
<div>
<FavoriteDiv key={cartItemProduct.id}>
<ImageDiv>
<img
src={cartItemProduct.photo}
alt={cartItemProduct.name}
style={{ width: '130px', height: '130px', padding: '20px' }}/>
</ImageDiv>
<img
src={cartItemProduct.photo}
alt={cartItemProduct.name}
style={{ width: '130px', height: '130px', padding: '20px' }}
/>
</ImageDiv>
<LabelBox>
<Label>{cartItemProduct.name}</Label>
<p>Category: {cartItemProduct.category}</p>
Expand Down
33 changes: 10 additions & 23 deletions src/app/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ import {
import CartItem from './cartItem';
import NavBar from '../../components/NavBarFolder/NavBar';
import {
PageDiv,
CheckoutButton,
LeftColumnDiv,
RightColumnDiv,
OrderButton,
DeliveryContainer,
OrderContainer,
Container,
Heading,
BackButtonDiv,
RightColumnDiv1,
InformationContainer,
LeftColumnDiv1,
OutterDiv
OutterDiv,
} from './styles';

import { ProductWithQuantity } from '../../schema/schema';
Expand Down Expand Up @@ -61,13 +53,12 @@ export default function OrderPage() {
<div>
<NavBar />
<OutterDiv>
<BackButtonDiv>
<BackButtonDiv>
<BackButton destination="/storefront" />
</BackButtonDiv>
<DeliveryContainer>

</BackButtonDiv>
<DeliveryContainer>
<InformationContainer>
<Heading1 style={{ marginBottom: '38px'}}>Cart</Heading1>
<Heading1 style={{ marginBottom: '38px' }}>Cart</Heading1>
{cart.map(cartItem => (
<CartItem
key={cartItem.id}
Expand All @@ -79,15 +70,11 @@ export default function OrderPage() {
/>
))}
</InformationContainer>
<OrderContainer>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<OrderButton
onClick={() => checkDelivery()}
>
Check Out
</OrderButton>
</OrderContainer>
</DeliveryContainer>
<OrderContainer>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<OrderButton onClick={() => checkDelivery()}>Check Out</OrderButton>
</OrderContainer>
</DeliveryContainer>
</OutterDiv>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/app/cart/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ export const InformationContainer = styled.div`
margin: 40px;
`;


export const OutterDiv = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -339,7 +338,7 @@ export const BackButtonDiv = styled.div`
flex-direction: row;
text-align: left;
width: 800px;
margin-left: 40px;
margin-left: 110px;
`;

export const CheckoutButton = styled.button`
Expand Down
48 changes: 23 additions & 25 deletions src/app/delivery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
InformationContainer,
InformationText,
BackButtonDiv,
OutterDiv
OutterDiv,
} from './styles';

export default function App() {
Expand Down Expand Up @@ -52,30 +52,28 @@ export default function App() {
<OutterDiv>
<BackButtonDiv>
<BackButton destination="/storefront" />
</BackButtonDiv>
<DeliveryContainer>
<InformationContainer>
<Heading1 style={{ marginBottom: '38px'}}>
Shipping
</Heading1>
<Normal700Text>Name</Normal700Text>
<InformationText>
{`${Profile?.first_name} ${Profile?.last_name}`}
</InformationText>
<Normal700Text>Address</Normal700Text>
<InformationText>
{UserAddress?.street}, {UserAddress?.city}, {UserAddress?.zipcode}
</InformationText>
</InformationContainer>
<OrderContainer>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<OrderButton
onClick={() => router.push('/orderConfirmationDelivery')}
>
Place Order
</OrderButton>
</OrderContainer>
</DeliveryContainer>
</BackButtonDiv>
<DeliveryContainer>
<InformationContainer>
<Heading1 style={{ marginBottom: '38px' }}>Shipping</Heading1>
<Normal700Text>Name</Normal700Text>
<InformationText>
{`${Profile?.first_name} ${Profile?.last_name}`}
</InformationText>
<Normal700Text>Address</Normal700Text>
<InformationText>
{UserAddress?.street}, {UserAddress?.city}, {UserAddress?.zipcode}
</InformationText>
</InformationContainer>
<OrderContainer>
<OrderSummary cart={cart} numberOfItems={numberOfItems} />
<OrderButton
onClick={() => router.push('/orderConfirmationDelivery')}
>
Place Order
</OrderButton>
</OrderContainer>
</DeliveryContainer>
</OutterDiv>
</main>
);
Expand Down
2 changes: 1 addition & 1 deletion src/app/delivery/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ export const BackButtonDiv = styled.div`
export const OutterDiv = styled.div`
display: flex;
flex-direction: column;
`;
`;
2 changes: 0 additions & 2 deletions src/styles/fonts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export const Heading5Bold = styled.p`
font-weight: 600;
line-height: normal;
margin-bottom: 28px;
`;

export const Heading5 = styled.p`
Expand All @@ -103,7 +102,6 @@ export const Body1 = styled.p`
font-style: normal;
font-weight: 400;
line-height: normal;
`;

export const Body1Bold = styled.p`
Expand Down

0 comments on commit ff96097

Please sign in to comment.