2022-02-14 17:48:52 +00:00
|
|
|
<script>
|
|
|
|
export let count = 0;
|
|
|
|
let items = new Set();
|
|
|
|
|
|
|
|
function onAddToCart(ev) {
|
|
|
|
const id = ev.detail;
|
|
|
|
items.add(id);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.cart {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2022-03-16 16:16:21 +00:00
|
|
|
text-decoration: none;
|
|
|
|
color: inherit;
|
2022-02-14 17:48:52 +00:00
|
|
|
}
|
|
|
|
.cart :first-child {
|
|
|
|
margin-right: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cart-icon {
|
|
|
|
font-size: 36px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.count {
|
|
|
|
font-size: 24px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<svelte:window on:add-to-cart={onAddToCart}/>
|
2022-03-16 16:16:21 +00:00
|
|
|
<a href="/cart" class="cart">
|
2022-02-14 17:48:52 +00:00
|
|
|
<span class="material-icons cart-icon">shopping_cart</span>
|
|
|
|
<span class="count">{count}</span>
|
2022-03-16 16:16:21 +00:00
|
|
|
</a>
|