loading first item when open morceaux. Pi j'ai enlevé le height du root parce que ça fait que le foot est par dessus du stock
This commit is contained in:
@@ -9,98 +9,110 @@ import { Card } from "react-bootstrap";
|
||||
// Discontinued
|
||||
// }
|
||||
function renderStatus(statusCode) {
|
||||
switch (statusCode) {
|
||||
case 0:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-available">
|
||||
Disponible
|
||||
</Card.Text>
|
||||
);
|
||||
if (statusCode !== undefined) {
|
||||
|
||||
case 1:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-backorder">
|
||||
En commande
|
||||
</Card.Text>
|
||||
);
|
||||
case 2:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-unavailable">
|
||||
Indisponible
|
||||
</Card.Text>
|
||||
);
|
||||
case 3:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-clearence">
|
||||
Liquidation
|
||||
</Card.Text>
|
||||
);
|
||||
case 4:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-promotion">
|
||||
Promotion
|
||||
</Card.Text>
|
||||
);
|
||||
case 5:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-discontinued">
|
||||
Discontinué
|
||||
</Card.Text>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<></>
|
||||
);
|
||||
switch (statusCode) {
|
||||
case 0:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-available">
|
||||
Disponible
|
||||
</Card.Text>
|
||||
);
|
||||
|
||||
case 1:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-backorder">
|
||||
En commande
|
||||
</Card.Text>
|
||||
);
|
||||
case 2:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-unavailable">
|
||||
Indisponible
|
||||
</Card.Text>
|
||||
);
|
||||
case 3:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-clearence">
|
||||
Liquidation
|
||||
</Card.Text>
|
||||
);
|
||||
case 4:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-promotion">
|
||||
Promotion
|
||||
</Card.Text>
|
||||
);
|
||||
case 5:
|
||||
return (
|
||||
<Card.Text className="item-status item-status-discontinued">
|
||||
Discontinué
|
||||
</Card.Text>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<></>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function renderPrice(price, newPrice, status) {
|
||||
if (price !== undefined) {
|
||||
|
||||
if (status != 3 && status != 4) {
|
||||
return (
|
||||
<Card.Text className="item-price-container">
|
||||
<span className="item-price">
|
||||
{price.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
</Card.Text>
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<Card.Text className="item-price-container">
|
||||
<span className="item-old-price">
|
||||
{price.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
<span className="item-new-price">
|
||||
{newPrice.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
</Card.Text>
|
||||
);
|
||||
|
||||
if (status != 3 && status != 4) {
|
||||
return (
|
||||
<Card.Text className="item-price-container">
|
||||
<span className="item-price">
|
||||
{price.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
</Card.Text>
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (
|
||||
<Card.Text className="item-price-container">
|
||||
<span className="item-old-price">
|
||||
{price.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
<span className="item-new-price">
|
||||
{newPrice.toFixed(2).toString().replace(".", ",")} $ CA
|
||||
</span>
|
||||
</Card.Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const Item = ({ imageUrl, name, price, newPrice, status }) => {
|
||||
return (
|
||||
if (name !== undefined) {
|
||||
return (
|
||||
|
||||
<Card className="item">
|
||||
<Card.Img className="item-img" variant="top" src={`/images/${imageUrl}_thumbnail.jpg`} />
|
||||
<Card.Body className="item-info">
|
||||
<div className="item-name-container">
|
||||
<Card.Title className="item-name">
|
||||
{name}
|
||||
</Card.Title>
|
||||
</div>
|
||||
<div className="item-status-container">
|
||||
{renderStatus(status)}
|
||||
</div>
|
||||
<div>
|
||||
{renderPrice(price, newPrice, status)}
|
||||
</div>
|
||||
<Card className="item">
|
||||
<Card.Img className="item-img" variant="top" src={`/images/${imageUrl}_thumbnail.jpg`} />
|
||||
<Card.Body className="item-info">
|
||||
<div className="item-name-container">
|
||||
<Card.Title className="item-name">
|
||||
{name}
|
||||
</Card.Title>
|
||||
</div>
|
||||
<div className="item-status-container">
|
||||
{renderStatus(status)}
|
||||
</div>
|
||||
<div>
|
||||
{renderPrice(price, newPrice, status)}
|
||||
</div>
|
||||
|
||||
</Card.Body>
|
||||
</Card>
|
||||
);
|
||||
</Card.Body>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
else {
|
||||
return (<></>);
|
||||
}
|
||||
}
|
||||
|
||||
export default Item;
|
Reference in New Issue
Block a user