blob: 5d4b7d2510c1ef44f0d64ef513742a23ba7c1d77 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<script>
let { count } = $props()
let items = new Set();
function onAddToCart(ev) {
const id = ev.detail;
items.add(id);
count++;
}
</script>
<style>
.cart {
display: flex;
align-items: center;
text-decoration: none;
color: inherit;
}
.cart :first-child {
margin-right: 5px;
}
.cart-icon {
font-size: 36px;
}
.count {
font-size: 24px;
}
</style>
<svelte:window onadd-to-cart={onAddToCart}/>
<a href="/cart" class="cart">
<span class="material-icons cart-icon">shopping_cart</span>
<span class="count">{count}</span>
</a>
|