07d13c9c
isisadmin
polymer catalog
|
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../catalog-cart/catalog-cart.html">
<dom-module id="cart-icon">
<style>
:host {
display: inline-block;
line-height: 40px;
width: 40px;
height: 40px;
cursor: pointer;
text-align: center;
}
iron-icon {
margin-top: -2px;
}
:host(.full) iron-icon {
color: var(--paper-pink-500);
}
</style>
<template>
<catalog-cart items="{{cartItems}}"></catalog-cart>
<iron-icon icon="stars"></iron-icon>
</template>
</dom-module>
<script>
Polymer({
is: 'cart-icon',
listeners: {
tap: 'openCart'
},
observers: [
'_anyItems(cartItems.length)'
],
openCart: function() {
this.fire('cart-open');
},
_anyItems: function() {
if (this.cartItems.length >= 1) {
this.classList.add('full');
} else {
this.classList.remove('full');
}
},
_pulse: function() {
this.classList.remove('pulse');
this.async(function() {
this.classList.add('pulse');
});
},
_shrink: function() {
}
});
</script>
|