Check stock for Shop's add to cart button
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
export let product: any
|
export let product: any
|
||||||
export let shopProduct: any
|
export let shopProduct: any
|
||||||
|
|
||||||
|
$: hasStock = shopProduct.stock_level > 0
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preview photos specs
|
* Preview photos specs
|
||||||
@@ -69,8 +71,10 @@
|
|||||||
<dd>{shopProduct.name} – {shopProduct.price}€</dd>
|
<dd>{shopProduct.name} – {shopProduct.price}€</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<Button
|
<Button
|
||||||
text="Add to cart"
|
tag="button"
|
||||||
|
text={hasStock ? 'Add to cart' : 'Sold out'}
|
||||||
color="pinklight"
|
color="pinklight"
|
||||||
|
disabled={!hasStock}
|
||||||
on:click={() => addToCart($cartId, shopProduct)}
|
on:click={() => addToCart($cartId, shopProduct)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Hover effect
|
// Hover effect
|
||||||
&:hover {
|
&:not([disabled]):hover {
|
||||||
background: $color-secondary;
|
background: $color-secondary;
|
||||||
}
|
}
|
||||||
.text-split__line {
|
.text-split__line {
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
background: $color-secondary-light;
|
background: $color-secondary-light;
|
||||||
|
|
||||||
// Hover
|
// Hover
|
||||||
&:hover {
|
&:not([disabled]):hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: $color-secondary;
|
background: $color-secondary;
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
background: $color-secondary;
|
background: $color-secondary;
|
||||||
|
|
||||||
// Hover
|
// Hover
|
||||||
&:hover {
|
&:not([disabled]):hover {
|
||||||
color: $color-text;
|
color: $color-text;
|
||||||
background-color: darken($color-secondary, 7);
|
background-color: darken($color-secondary, 7);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user