This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map-menu-item.html
executable file
·83 lines (75 loc) · 1.88 KB
/
map-menu-item.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../paper-button/paper-button.html">
<dom-module id="map-menu-item">
<template>
<style>
:host {
display: block;
--map-menu-item-height: 16px;
}
:host[active] {
background: var(--map-menu-active-color);
}
iron-icon {
--iron-icon-height: var(--map-menu-item-height);
}
#title {
font-size: .9em;
text-transform: none;
}
</style>
<paper-button id="wrapper" href$="[[url]]" role="link" noink on-tap="_click">
<template is="dom-if" if="[[__hasIcon(icon)]]">
<iron-icon icon="[[icon]]"></iron-icon>
</template>
<span id="title">[[title]]</span>
</paper-button>
</template>
<script>
Polymer({
is: 'map-menu-item',
properties: {
icon: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
url: {
type: String,
value: ''
},
icon: {
type: String,
},
id: {
type: String,
reflectToAttribute: true,
},
active: {
type: Boolean,
value: false,
observer: '__activeChanged',
}
},
_click: function () {
this.fire('link-clicked', { id: this.id });
},
attached: function () {
this.fire('child-attached', { id: this.id });
},
__activeChanged: function (active, oldActive) {
if (active === oldActive) return;
if (active === true) {
this.fire('active-item', { id: this.id });
}
},
__hasIcon: function (icon) {
return (icon || icon === '') ? true : false
},
});
</script>
</dom-module>