-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebdash-embed.html
More file actions
58 lines (45 loc) · 1.24 KB
/
Copy pathwebdash-embed.html
File metadata and controls
58 lines (45 loc) · 1.24 KB
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
<link rel="import" href="/bower_components/polymer/polymer-element.html">
<link rel="import" href="/bower_components/empty-state-webdash/empty-state-webdash.html">
<dom-module id="webdash-embed">
<template>
<style>
:host {
display: block;
}
#embed {
display: flex;
align-items: center;
justify-content: center;
}
</style>
<div id="embed"></div>
<template is="dom-if" if="{{emptyState}}">
<empty-state-webdash title="No embed code found">
Add an embed code in
<strong>"embed"</strong> key in your webdash.json
</empty-state-webdash>
</template>
</template>
<script>
class WebdashEmbed extends Polymer.Element {
static get is() { return 'webdash-embed'; }
ready() {
super.ready();
this.backend = new Backend(WebdashEmbed.is);
this.run();
}
run() {
const config = window.webdashConfig;
if (config && config.embed) {
this.embed(config.embed);
} else {
this.emptyState = true;
}
}
embed(code) {
this.$.embed.innerHTML = code;
}
}
window.customElements.define(WebdashEmbed.is, WebdashEmbed);
</script>
</dom-module>