Skip to content

Commit f761007

Browse files
Merge pull request #24 from bhagirathpaliyal/Order
style order card
2 parents 51c619e + 85bbe4d commit f761007

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

src/components/Order/Order.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ console.log(orderItems)
2525
<h2>Your order</h2>
2626

2727
{loading ? (
28-
<div className=' flex gap-[20px] flex-wrap mx-[50px]'>
28+
<div className=' flex flex-col gap-[20px] mx-[50px]'>
2929
{ skeleton.map((data,index) => (
3030
<ItemSkeleton key={index}/>
3131
))}
3232
</div>
3333
) : (
3434
<>
3535

36-
<div className='flex flex-wrap gap-[20px] justify-center '>
36+
<div className='flex flex-col gap-[20px] justify-center '>
3737
{orderItems.length > 0 ? (
3838
orderItems.map((item, index) => (
3939
item.user.email === user.email && ( <OrderCard key={index} data={item

src/components/Order/OrderCard.jsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
import React from 'react'
1+
import React from 'react';
2+
import { Card, CardContent, Typography } from '@mui/material';
3+
import { styled } from '@mui/material/styles';
24

3-
const OrderCard = (prop) => {
4-
return (
5-
<div className='border p-5 rounded-[10px]'>
6-
<h4>OrderId : <span>{prop.data.orderId}</span></h4>
7-
<p>Product Name : <span>{prop.data.orderedProducts.name}</span></p>
8-
<p>Product Price : <span>{prop.data.orderedProducts.Price}</span></p>
9-
<p>Merchant Name : <span>{prop.data.merchant?.name}</span></p>
5+
const StyledCard = styled(Card)(({ theme }) => ({
6+
borderRadius: '10px',
7+
padding: theme.spacing(2),
8+
boxShadow: theme.shadows[3],
9+
}));
1010

11-
</div>
12-
)
13-
}
11+
const OrderCard = ({ data }) => {
12+
return (
13+
<StyledCard className="border p-5 rounded-[10px] flex items-center">
14+
<img
15+
src={data.orderedProducts.image}
16+
alt="Product"
17+
className="h-[300px] w-auto mb-4"
18+
/>
19+
<CardContent>
20+
<Typography variant="h6" gutterBottom>
21+
OrderId: <span className="font-bold">{data.orderId}</span>
22+
</Typography>
23+
<Typography variant="body1">
24+
Product Name: <span className="font-bold">{data.orderedProducts.name}</span>
25+
</Typography>
26+
<Typography variant="body1">
27+
Product Price: <span className="font-bold">${data.orderedProducts.Price}</span>
28+
</Typography>
29+
<Typography variant="body1">
30+
Merchant Name: <span className="font-bold">{data.merchant?.name}</span>
31+
</Typography>
32+
</CardContent>
33+
</StyledCard>
34+
);
35+
};
1436

15-
export default OrderCard
37+
export default OrderCard;

0 commit comments

Comments
 (0)