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