-
Notifications
You must be signed in to change notification settings - Fork 0
/
holding-fire.html
442 lines (403 loc) · 14.3 KB
/
holding-fire.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../polymerfire/firebase-document.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../iron-media-query/iron-media-query.html">
<!--
`holding-fire`
Example:
```
<firebase-app
name="demo"
api-key="API_KEY"
auth-domain="AUTH_DOMAIN"
database-url="DATABASE_URL"
></firebase-app>
<holding-fire
app-name="demo"
path="users/"
logo="images/logo.png"
text="Website coming soon! Subscribe to find out when we launch!"
email="[email protected]"
></holding-fire>
```
### Styling
Style the element with CSS as you would a normal DOM element.
The following custom properties and mixins are available for styling:
| Custom property | Description |
| --- | --- |
| `--holding-fire-host` | Mixin for the host element |
| `--holding-fire-overlay` | Mixin for an overlay |
| `--holding-fire-container` | Mixin for the container |
| `--holding-fire-logo` | Mixin for the logo |
| `--holding-fire-inner-container` | Mixin for the inner container with content and form |
| `--holding-fire-content` | Mixin for the content section |
| `---holding-fire-subscribe-container` | Mixin for the subscribe container|
| `---holding-fire-subscribe-title` | Mixin for the subscribe title|
| `---holding-fire-subscribe-form` | Mixin for the subscribe form|
| `--holding-fire-input` | Mixin for the inputs |
| `---holding-fire-subscribe-button` | Mixin for the subscribe button|
| `--holding-fire-email` | Mixin for the email paragraph |
| `--holding-fire-email-link` | Mixin for the email text |
| `---holding-fire-thanks-container` | Mixin for the thanks container|
| `---holding-fire-thanks-title` | Mixin for the thanks title|
| `---holding-fire-thanks-section` | Mixin for the thanks section|
| `--holding-fire-twitter-link` | Mixin for the twitter link |
| `--holding-fire-twitter-button` | Mixin for the twitter button |
| `--holding-fire-animations` | Mixin for any animations you want to define. First one will not be registered. See demo. |
@demo demo/index.html
-->
<dom-module id="holding-fire">
<template>
<style>
:host {
display: block;
padding: var(--mobile-border, 50px);
@apply(--layout-center);
background: #000;
background-repeat: no-repeat;
background-size: cover;
@apply(--holding-fire-host);
}
.overlay{
@apply(--holding-fire-overlay);
}
.container{
display: block;
overflow: hidden;
max-width: 960px;
text-align: center;
margin: auto;
padding: 20px;
z-index: 400;
opacity: 1;
background: white;
@apply(--holding-fire-container);
}
.logo{
max-width: 200px;
margin: 20px auto;
padding-bottom: 30px;
@apply(--holding-fire-logo);
}
.inner-container{
/*@apply(--layout-horizontal);
@apply(--layout-wrap);*/
@apply(--layout-vertical);
@apply(--holding-fire-inner-container);
}
.content{
color: #000000;
text-align: center;
margin: auto;
padding: 20px;
min-width: 280px;
max-width: 500px;
@apply(--holding-fire-content);
}
.subscribe-container{
min-width: 280px;
margin: auto;
text-align: left;
@apply(--holding-fire-subscribe-container);
}
.subscribe-title{
padding:20px;
padding-left:30px;
@apply(--holding-fire-subscribe-title);
}
.subscribe-form{
padding-top: 20px;
padding-left: 35px;
padding-right: 40px;
padding-bottom: 5px;
@apply(--holding-fire-subscribe-form);
}
paper-input.custom {
z-index: 400;
text-align: left;
--paper-input-container-color: var(--holding-fire-input-container-color);
--paper-input-container-focus-color: var(--holding-fire-input-container-focus-color);
--paper-input-container-invalid-color: var(--holding-fire-input-invalid-color);
--paper-input-container-input-color: var(--holding-fire-input-color);
@apply(--holding-fire-input);
}
paper-button.subscribe {
z-index: 400;
width: 100%;
@apply(--holding-fire-subscribe-button);
}
.email {
text-align: center;
@apply(--holding-fire-email);
}
.email a{
opacity: 0.32;
font-size: 11px;
color: #000000;
text-align: center;
text-decoration:none;
@apply(--holding-fire-email-link);
}
.thanks-container{
min-width: 280px;
margin: auto;
text-align: left;
@apply(--holding-fire-thanks-container);
}
.thanks-title{
padding:20px;
padding-left:30px;
@apply(--holding-fire-thanks-title);
}
.thanks-section{
padding-top: 20px;
padding-left: 35px;
padding-right: 40px;
padding-bottom: 5px;
height: 100%;
padding: 20px;
@apply(--layout-vertical);
@apply(--layout-center);
@apply(--holding-fire-thanks-section);
}
.thanks-section a {
width: 100%;
text-decoration: none;
@apply(--holding-fire-twitter-link)
}
paper-button.twitter {
z-index: 400;
margin: auto;
width: 90%;
margin-left: 20px;
background-color: #58aae8;
color: white;
height: 40px;
font-weight: bold;
font-size: 14px;
margin-top: 20px;
margin-bottom: 20px;
text-transform: capitalize;
@apply(--holding-fire-twitter-button);
}
.twitter-icon {
@apply(--holding-fire-twitter-icon);
}
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@apply(--holding-fire-animations);
</style>
<firebase-document
id="doc"
app-name="[[appName]]"
path="[[path]]"
data="{{data}}">
</firebase-document>
<iron-media-query query="(max-width: 600px)" query-matches="{{smallScreen}}"></iron-media-query>
<div class="overlay"></div>
<div class="container">
<img src="[[logo]]" class="logo" sizing="contain" alt="[[alt]]]">
<div class="inner-container">
<div class="content"> <slot></slot></div>
<template is="dom-if" if="{{!subscribed}}" class="hidden">
<div class="subscribe-container">
<div class="subscribe-title noselect">[[subHeader]]</div>
<div class="subscribe-form">
<template is="dom-if" if="{{!noName}}">
<paper-input label="Name" class="custom" id="name" required error-message="Please enter your name" on-keydown="_catchEnter"></paper-input></br>
</template>
<paper-input label="Email address" class="custom" id="email" type="email" required error-message="Please enter a valid email address" on-keydown="_catchEnter"></paper-input></br>
<paper-button raised="[[!flatButtons]]" class="subscribe" on-tap="subscribe">[[subButton]]</paper-button>
<p class="email"><a href="mailto:[[email]]">[[email]]</a></p>
</div>
</div>
</template>
<template is="dom-if" if="{{subscribed}}">
<div class="thanks-container">
<div class="thanks-title noselect">[[thanksHeader]]</div>
<div class="thanks-section">
<p class="thanks-message noselect">[[thanks]]</p>
<template is="dom-if" if="{{twitter}}">
<a href$="https://twitter.com/[[twitter]]" target="_blank" tabindex="-1" class="button">
<paper-button raised="[[!flatButtons]]" class="twitter">
<svg viewBox="0 0 20.34 16.17" style="height:15px;fill:#FFF; padding-left: 10px; padding-right: 10px" class="twitter-icon">
<path class="515a544b-2ee6-4052-8329-f9002443fb0f" d="M7,16.61A11.39,11.39,0,0,0,18.43,5.14q0-.26,0-0.52a8.2,8.2,0,0,0,2-2.09,8,8,0,0,1-2.31.63A4,4,0,0,0,19.89.94a8.08,8.08,0,0,1-2.56,1,4,4,0,0,0-6.87,3.68A11.44,11.44,0,0,1,2.15,1.38,4,4,0,0,0,3.4,6.76a4,4,0,0,1-1.83-.5s0,0,0,.05a4,4,0,0,0,3.23,4A4,4,0,0,1,3,10.33a4,4,0,0,0,3.77,2.8,8.09,8.09,0,0,1-5,1.73,8.19,8.19,0,0,1-1-.06A11.41,11.41,0,0,0,7,16.61" transform="translate(-0.36 -0.55)"/>
</svg>Follow us on Twitter
</paper-button>
</a>
</template>
</div>
</div>
</template>
</div>
</div>
</template>
<script>
Polymer({
is: 'holding-fire',
properties: {
/**
* Link to the image file for the logo
*
* @type {String}
*/
logo: {
type: String,
},
/**
* Value denotes if the user is on a small screen
*
* @type {Boolean}
*/
smallScreen: {
type: Boolean,
observer: '_smallScreen'
},
/**
* Text to be displayed below the logo
*
* @type {String}
*/
text: {
type: String,
},
/**
* Text to be displayed to thank the user
*
* @type {String}
*/
thanks: {
type: String,
},
/**
* Header text for thanks section
*
* @type {String}
*/
thanksHeader: {
type: String,
value: "THANKS FOR SUBSCRIBING"
},
/**
* Email to be displayed below the subscription form
*
* @type {String}
*/
email: {
type: String,
},
/**
* The name of the firebase app
*
* @type {String}
*/
appName: {
type: String,
},
/**
* The storage path for the subscription emails
*
* @type {String}
*/
path: {
type: String,
},
/**
* Indicates if the user has subscribed
*
* @type {Boolean}
*/
subscribed: {
type: Boolean,
value: false,
},
/**
* Alt text for the logo
*
* @type {String}
*/
alt: {
type: String,
},
/**
* Header text for subscription section
*
* @type {String}
*/
subHeader: {
type: String,
value: "BE THE FIRST TO KNOW"
},
/**
* Button text for subscription section
*
* @type {String}
*/
subButton: {
type: String,
value: "Subscribe"
},
/**
* Whether to ask for name or not
*
* @type {Boolean}
*/
noName: {
type: Boolean,
value: false
},
/**
* Whether to use flat buttons
*
* @type {Boolean}
*/
flatButtons: {
type: Boolean,
value: false
},
},
_smallScreen: function(){
if (this.smallScreen){
this.customStyle['--mobile-border'] = '5px';
this.updateStyles();
} else {
this.customStyle['--mobile-border'] = '50px';
this.updateStyles();
}
},
subscribe: function(){
e = this.$$("#email").validate()
n = true;
if(!this.noName){
n = this.$$("#name").validate()
}
if( n && e ){
var date = new Date();
var epoch = date.getTime();
var obj = {
email: this.$$("#email").value,
date: epoch
}
if(!this.noName){
obj.name = this.$$("#name").value;
}
this.$.doc.ref.push(obj);
this.subscribed = true;
}
},
_catchEnter: function(e){
if (e.keyCode ===13){
this.subscribe();
}
}
});
</script>
</dom-module>