This repository has been archived by the owner on Aug 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo-hours.html
152 lines (128 loc) · 3.55 KB
/
demo-hours.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
<link rel="import" href="../polymer/polymer.html">
<!-- Iron elements -->
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../iron-image/iron-image.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<!-- Paper elements -->
<link rel="import" href="../paper-card/paper-card.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-item/paper-item-body.html">
<link rel="import" href="../paper-item/paper-icon-item.html">
<!-- Custom elements -->
<link rel="import" href="content-icons.html">
<!--
`demo-hours`
@demo demo/hours/index.html
-->
<dom-module id="demo-hours">
<template>
<style>
:host {
display: block;
font-family: "Roboto","Helvetica","Arial",sans-serif;
}
paper-card {
width: 100%;
max-width: 900px;
min-width: 372px;
}
paper-item-body {
color: #616161;
font-size: 18px;
line-height: 28px;
}
iron-image {
width: 40px;
height: 40px;
border-radius: 50%;
}
.table {
display: table;
padding: 0.5em 0;
}
.row {
display: table-row;
}
.row.closed {
opacity: .5;
}
.cell {
display: table-cell;
padding: 0.2em 0.5em;
text-transform: capitalize;
}
</style>
<paper-card role="listbox">
<template is="dom-if" if="[[!header.type]]">
<paper-item>
<paper-item-body two-line>
<div style="font-weight: 600;">[[header.title]]</div>
<div secondary>[[header.secondary]]</div>
</paper-item-body>
</paper-item>
</template>
<template is="dom-if" if="[[header.type]]">
<paper-icon-item>
<iron-pages
item-icon
attr-for-selected="name"
selected="[[header.type]]"
fallback-selection="default">
<iron-image
name="profile"
fade
sizing="contain"
src="[[header.media]]"></iron-image>
<iron-icon
name="default"
icon="[[header.icon]]"></iron-icon>
</iron-pages>
<paper-item-body two-line>
<div style="font-weight: 600;">[[header.title]]</div>
<div secondary>[[header.secondary]]</div>
</paper-item-body>
</paper-icon-item>
</template>
<!-- table -->
<paper-icon-item>
<paper-item-body>
<section class="table">
<template is="dom-repeat" items="[[hours]]">
<div class$="row [[_isClosed(item.opens, item.closes)]]">
<div class="cell">[[item.day]]</div>
<div class="cell">[[_computeOpenHours(item.opens, item.closes)]]</div>
</div>
</template>
</section>
</paper-item-body>
</paper-icon-item>
</paper-card>
</template>
<script>
Polymer({
is: 'demo-hours',
properties: {
header: {
type: Object,
value: function() {
return {};
}
},
hours: {
type: Array,
value: function() {
return [];
}
}
},
behaviors: [],
listeners: {},
_isClosed: function(opens, closes) {
return opens && closes ? "open" : "closed";
},
_computeOpenHours: function(opens, closes) {
return opens && closes ? opens+" - "+closes : "Closed";
}
});
</script>
</dom-module>