Refactored stock count on Product page
This commit is contained in:
@@ -21,7 +21,7 @@ export default function Home() {
|
|||||||
name: "Item 2",
|
name: "Item 2",
|
||||||
description: "Description 2",
|
description: "Description 2",
|
||||||
price: 20,
|
price: 20,
|
||||||
stock: 200,
|
stock: 9,
|
||||||
category: "Category 2",
|
category: "Category 2",
|
||||||
rating: 4.0,
|
rating: 4.0,
|
||||||
discount: 20,
|
discount: 20,
|
||||||
@@ -31,7 +31,7 @@ export default function Home() {
|
|||||||
name: "Item 3",
|
name: "Item 3",
|
||||||
description: "Description 3",
|
description: "Description 3",
|
||||||
price: 30,
|
price: 30,
|
||||||
stock: 300,
|
stock: 10,
|
||||||
category: "Category 3",
|
category: "Category 3",
|
||||||
rating: 4.8,
|
rating: 4.8,
|
||||||
discount: 15,
|
discount: 15,
|
||||||
@@ -41,7 +41,7 @@ export default function Home() {
|
|||||||
name: "Item 3",
|
name: "Item 3",
|
||||||
description: "Description 3",
|
description: "Description 3",
|
||||||
price: 30,
|
price: 30,
|
||||||
stock: 300,
|
stock: 0,
|
||||||
category: "Category 3",
|
category: "Category 3",
|
||||||
rating: 4.8,
|
rating: 4.8,
|
||||||
discount: 15,
|
discount: 15,
|
||||||
|
|||||||
@@ -130,17 +130,15 @@ export default function Product() {
|
|||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<Typography variant="body1">
|
|
||||||
{item.description}
|
|
||||||
</Typography>
|
|
||||||
|
|
||||||
<Box>
|
<Box>
|
||||||
{item.stock > 0 ? (
|
{item.stock > 10 ? (
|
||||||
<Alert severity="success">
|
<Alert severity="success" variant='outlined'>
|
||||||
In Stock ({item.stock} available)
|
In Stock ({item.stock} available)
|
||||||
</Alert>
|
</Alert>
|
||||||
|
) : item.stock > 0 ? (
|
||||||
|
<Alert severity="warning" variant='outlined'>Almost sold out ({item.stock} available)</Alert>
|
||||||
) : (
|
) : (
|
||||||
<Alert severity="error">Out of Stock</Alert>
|
<Alert severity="error" variant='filled'>Out of Stock</Alert>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@@ -171,9 +169,16 @@ export default function Product() {
|
|||||||
Free shipping on orders over €50
|
Free shipping on orders over €50
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<div className='contact-divider-box'>
|
||||||
|
<Divider className='contact-divider'/>
|
||||||
|
</div>
|
||||||
|
<Typography variant="body1">
|
||||||
|
{item.description}
|
||||||
|
</Typography>
|
||||||
</Container>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user