forked from ebidel/material-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elements.html
110 lines (94 loc) · 3.55 KB
/
elements.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
<link rel="import" href="bower_components/font-roboto/roboto.html">
<!-- <link rel="import" href="bower_components/core-drawer-panel/core-drawer-panel.html"> -->
<link rel="import" href="bower_components/core-header-panel/core-header-panel.html">
<!-- <link rel="import" href="bower_components/paper-appbar/paper-appbar.html"> -->
<link rel="import" href="bower_components/core-icons/core-icons.html">
<link rel="import" href="bower_components/core-icons/iconsets/hardware-icons.html">
<link rel="import" href="bower_components/core-toolbar/core-toolbar.html">
<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="bower_components/paper-button/paper-button.html">
<link rel="import" href="bower_components/paper-shadow/paper-shadow.html">
<link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="bower_components/paper-fab/paper-fab.html">
<link rel="import" href="bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="bower_components/paper-dialog/paper-dialog-transition.html">
<link rel="import" href="bower_components/paper-radio-button/paper-radio-button.html">
<link rel="import" href="bower_components/paper-radio-group/paper-radio-group.html">
<link rel="import" href="bower_components/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="bower_components/paper-input/paper-input.html">
<link rel="import" href="bower_components/paper-slider/paper-slider.html">
<link rel="import" href="bower_components/paper-progress/paper-progress.html">
<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
<!-- <link rel="import" href="bower_components/core-theme-aware/core-theme-aware.html"> -->
<polymer-element name="x-card" attributes="zHover" on-mouseover="{{onMouseOver}}" on-mouseout="{{onMouseOut}}">
<template>
<style>
:host {
display: block;
background: white;
width: 400px;
height: auto;
position: relative;
border-radius: 2px;
}
@media all and (max-width: 400px) {
:host {
width: 275px;
}
}
polymer-next-selector { content: ':host img'; }
::content img {
object-fit: cover;
/*object-position: 50% 100%;*/
width: 100%;
height: 250px;
border-radius: inherit;
}
polymer-next-selector { content: ':host .heading'; }
::content .heading {
margin-bottom: 35px;
}
#cardcontent {
padding: 25px;
}
paper-ripple {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 250px;
color: white;
}
</style>
<content id="c" select="img"></content>
<div id="cardcontent"><content></content></div>
<template if="{{hasImage}}">
<paper-ripple class="recenteringTouch"></paper-ripple>
</template>
<paper-shadow target="{{}}" z="{{zReal}}" animated></paper-shadow>
</template>
<script>
Polymer('x-card', {
zHover: null,
hasImage: false,
publish: {
z: {value: 1, reflect: true},
},
ready: function() {
this.zReal = this.z;
this.hasImage = this.$.c.getDistributedNodes().length;
},
onMouseOver: function(e, detail, sender) {
if (this.zHover != null) {
this.zReal = this.zHover;
}
},
onMouseOut: function(e, detail, sender) {
if (this.zHover != null) {
this.zReal = this.z;
}
}
});
</script>
</polymer-element>