-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfirebase-error-dialog.html
122 lines (94 loc) · 2.82 KB
/
firebase-error-dialog.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
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../paper-button/paper-button.html">
<!--
`<firebase-error-dialog>` is a dialog with Material Design styling and optional animations that leverage firebase error message.
See `Polymer.PaperDialogBehavior` for specifics.
Example:
<firebase-error-dialog
modal with-backdrop>
<span error>Bad error!</span>
</firebase-error-dialog>
### Styling
See the docs of `Polymer.PaperDialogBehavior` for the custom properties available for styling
this element.
### Animations
Set the `entry-animation` and/or `exit-animation` attributes to add an animation when the dialog
is opened or closed. See the documentation in
[PolymerElements/neon-animation](https://github.com/PolymerElements/neon-animation) for more info.
For example:
<link rel="import" href="components/neon-animation/animations/scale-up-animation.html">
<link rel="import" href="components/neon-animation/animations/fade-out-animation.html">
<firebase-error-dialog
entry-animation="scale-up-animation"
exit-animation="fade-out-animation"
...
>
</firebase-error-dialog>
### Accessibility
See the docs of `Polymer.PaperDialogBehavior` for accessibility features implemented by this
element.
@group GoogleWebComponents Elements
@element firebase-error-dialog
@hero hero.svg
@demo demo/index.html
-->
<dom-module id="firebase-error-dialog">
<template>
<style include="paper-dialog-shared-styles"></style>
<style>
:host {
display: block;
}
#error {
text-align: center;
padding-left: 24px;
}
iron-icon {
--iron-icon-fill-color: red;
}
</style>
<h2>Error</h2>
<div id="error">
<iron-icon icon="error"></iron-icon>
<b><content select="[error]"></content></b>
</div>
<div class="buttons">
<paper-button dialog-confirm raised>OK</paper-button>
</div>
</template>
<script>
Polymer({
is: 'firebase-error-dialog',
behaviors: [
Polymer.PaperDialogBehavior,
Polymer.NeonAnimationRunnerBehavior
],
listeners: {
'neon-animation-finish': '_onNeonAnimationFinish'
},
//
// Element Behavior
//
_renderOpened: function() {
if (this.withBackdrop) {
this.backdropElement.open();
}
this.playAnimation('entry');
},
_renderClosed: function() {
if (this.withBackdrop) {
this.backdropElement.close();
}
this.playAnimation('exit');
},
_onNeonAnimationFinish: function() {
if (this.opened) {
this._finishRenderOpened();
} else {
this._finishRenderClosed();
}
}
});
</script>
</dom-module>