-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnav-item.html
37 lines (36 loc) · 1.25 KB
/
nav-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
<link rel="import" href="../polymer/polymer.html"/>
<link rel="import" href="../iron-icon/iron-icon.html"/>
<link rel="import" href="../iron-icons/iron-icons.html"/>
<dom-module id="nav-item">
<template>
<style>
#navlink { height:56px; display:flex; align-items:center; color:dimgrey; padding-left:16px; padding-right:20px; cursor:pointer; }
#navlink:hover { background-color:gainsboro }
iron-icon { padding-right:4px }
</style>
<div id="navlink" on-tap="navigate">
<template is="dom-if" if="icon != undefined">
<iron-icon icon="{{icon}}"></iron-icon>
</template>
<content></content>
</div>
</template>
<script>
Polymer({
is: "nav-item",
properties: {
href: String,
icon: String,
target: String
},
navigate: function () {
if (this.href == undefined) return;
this.fire("xenon-layout-navigate");
if (this.target == "_blank")
window.open(this.href);
else
window.location = this.href;
}
});
</script>
</dom-module>