-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyolap-typeahead-url.html
81 lines (78 loc) · 1.86 KB
/
yolap-typeahead-url.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
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="./yolap-behaviors.html">
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<dom-module id="yolap-typeahead-url">
<style>
:host {
position: relative;
width: 100px;
}
:host .input{
position: relative;
height: 30px;
width: 150px;
}
:host .input>input{
width: inherit;
height: inherit;
}
:host .input>.suggest{
width: inherit;
position: relative;
z-index: 100;
display: table-caption;
max-height: 300px;
overflow-y: scroll;
overflow-x: hidden;
}
:host .input>.suggest>.active{
background-color: rgba(20,200,0,1);
}
:host .input>.suggest>div{
background-color: grey;
width: inherit;
padding-left: 10px;
}
:host .input>.suggest a{
text-decoration: none;
color: black;
}
:host .input>.suggest>div:hover{
cursor: pointer;
border-top: solid 1px;
border-bottom: solid 1px;
}
</style>
<template>
<div class="input">
<input type="text" id="input" value='' placeholder='Input search query' on-input='valueHandle'>
<div id="suggestions" class="suggest">
<template is='dom-repeat' items='{{suggest}}'>
<div>
<a href="{{item.url}}">
<span>{{item.name}}</span>
<template is='dom-if' if='{{icon}}'>
<iron-icon icon="{{icon}}"></iron-icon>
</template>
</a>
</div>
</template>
</div>
</div>
</template>
</dom-module>
<script>
Polymer({
is: 'yolap-typeahead-url',
properties: {
icon: {
type: String,
},
},
behaviors: [TypeaheadYolapBehavior],
valueHandle: function(){
this.query = this.$.input.value;
},
});
</script>