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 7
/
hax-stax-browser-item.html
166 lines (160 loc) · 3.96 KB
/
hax-stax-browser-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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-card/paper-card.html">
<link rel="import" href="../iron-image/iron-image.html">
<link rel="import" href="../materializecss-styles/colors.html">
<!--
`hax-stax-browser-item`
A button on the hax-gizmo-browser app display
@demo demo/index.html
@microcopy - the mental model for this element
-
-->
<dom-module id="hax-stax-browser-item">
<template>
<style include="materializecss-styles-colors">
:host {
display: inline-flex;
}
:host[elevation="1"] {
-webkit-transform: scale(1, 1);
transform: scale(1, 1);
}
:host[elevation="2"] {
-webkit-transform: scale(1.4, 1.4);
transform: scale(1.4, 1.4);
}
paper-card {
margin: 4px 0;
border-radius: 10px;
}
paper-button {
color: #222222;
text-transform: none;
margin:0;
background-color: #FFFFFF;
height: 80px !important;
width: 200px !important;
display: flex;
border-radius: 10px;
border: 4px solid #CCCCCC;
min-width: unset;
}
paper-button .item-title {
font-size: 14px;
display: inline-flex;
}
paper-button .button-inner {
text-align: center;
}
.flip-icon {
transform: rotateY(180deg);
}
@media screen and (max-width: 550px) {
paper-button .item-title {
font-size: 10px;
}
}
</style>
<paper-card id="card" elevation="[[elevation]]">
<paper-button id="button" on-tap="_fireEvent" data-voicecommand$="select [[title]]">
<div class="button-inner">
<iron-image src="[[image]]" preload sizing="cover" hidden$="[[!image]]"></iron-image>
<div class="item-title">[[title]]</div>
</div>
</paper-button>
</paper-card>
</template>
<script>
Polymer({
is: 'hax-stax-browser-item',
listeners: {
'mousedown': 'tapEventOn',
'mouseover': 'tapEventOn',
'mouseout': 'tapEventOff',
'button.focusin': 'tapEventOn',
'button.focusout': 'tapEventOff',
},
properties: {
/**
* Title
*/
title: {
type: String,
},
/**
* Index position in the original list of imports
*/
staxReference: {
type: Object,
},
/**
* Image for the button, optional.
*/
image: {
type: String,
value: false,
},
/**
* Author related to this gizmo
*/
author: {
type: String,
},
/**
* Description for this.
*/
description: {
type: String,
},
/**
* Examples, a list of image links, optional.
*/
examples: {
type: Array,
},
/**
* Status, whether disabled, enabled, or other future states.
*/
status: {
type: Array
},
/**
* Tag
*/
tag: {
type: String,
},
/**
* Elevation off the UI
*/
elevation: {
type: Number,
value: 1,
reflectToAttribute: true,
},
},
/**
* special handling for taps on the thing
*/
tapEventOn: function (e) {
this.elevation = 2;
},
/**
* Hover off stop showing the deeper shadow.
*/
tapEventOff: function (e) {
this.elevation = 1;
},
/**
* Fire an event that includes the eventName of what was just pressed.
*/
_fireEvent: function(e) {
for (var i=0; i< this.stax.length; i++) {
this.fire('hax-insert-content', this.stax[i]);
}
Polymer.HaxStore.instance.haxStaxPicker.close();
},
});
</script>
</dom-module>