-
Notifications
You must be signed in to change notification settings - Fork 0
/
strolch-wc-notification.html
108 lines (97 loc) · 3.32 KB
/
strolch-wc-notification.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
<!-- Components -->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../neon-animation/neon-animations.html">
<link rel="import" href="../neon-animation/neon-animation-runner-behavior.html">
<link rel="import" href="../neon-animation/animations/slide-from-top-animation.html">
<link rel="import" href="../strolch-wc-styles/strolch-wc-styles.html">
<dom-module id="strolch-wc-notification">
<template>
<!-- Style -->
<style is="custom-style" include="strolch-wc-styles">
:host {
display: block;
height: var(--app-notification-height);
padding: 0 32px;
color: white;
background-color: var(--paper-red-300);
@apply(--layout-horizontal);
@apply(--layout-center);
}
.message {
font-size: 18px;
}
:host > :not(:first-child) {
margin: 0 0 0 8px;
}
.mid-space {
display: inline-block;
margin-left: auto;
}
</style>
<!-- Content -->
<i class$="fa [[faIcon]] message" aria-hidden="true"></i> <span class="message">[[message]]</span>
<div class="mid-space"></div>
<template is="dom-if" if="[[action1]]">
<paper-button on-tap="onAction1Tapped">
[[action1]]
</paper-button>
</template>
<template is="dom-if" if="[[action2]]">
<paper-button on-tap="onAction2Tapped">
[[action2]]
</paper-button>
</template>
<template is="dom-if" if="[[action3]]">
<paper-button on-tap="onAction3Tapped">
[[action3]]
</paper-button>
</template>
</template>
<script>
Polymer({
<!-- Settings -->
is: "strolch-wc-notification",
<!-- Behaviors -->
behaviors: [
Polymer.NeonAnimationRunnerBehavior
],
<!-- Properties -->
properties: {
animationConfig: {
value: function () {
return {
node: this,
name: "slide-from-top-animation",
timing: {
"duration": 700,
"delay": 300
}
}
}
},
faIcon: {
type: String,
value: "fa-exclamation-triangle"
},
message: {
type: String,
value: "..."
}
},
<!-- Functions -->
ready: function () {
this.playAnimation();
},
onAction1Tapped: function (event) {
this.callback1.bind(this.bind)();
},
onAction2Tapped: function (event) {
this.callback2.bind(this.bind)();
},
onAction3Tapped: function (event) {
this.callback3.bind(this.bind)();
}
});
</script>
</dom-module>