hero-image.html
800 Bytes
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
<link rel="import" href="../../bower_components/iron-image/iron-image.html">
<dom-module id="hero-image">
<style>
:host {
position: relative;
@apply(--layout-horizontal);
@apply(--layout-center-justified);
@apply(--layout-center);
}
iron-image {
@apply(--layout-fit);
}
iron-image::shadow img {
fill: white;
}
</style>
<template>
</template>
</dom-module>
<script>
Polymer({
is: 'hero-image',
properties: {
src: {type: String, observer: '_update'},
_src: String
},
ready: function() {
this._update();
},
_update: function(src) {
if (src && src.length) {
this._src = src;
} else {
this._src = "/images/hero/random-" + Math.ceil(Math.random() * 4) + ".svg";
}
}
});
</script>