-
Notifications
You must be signed in to change notification settings - Fork 3
/
post-card.back
executable file
·68 lines (67 loc) · 1.53 KB
/
post-card.back
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
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="post-card" attributes="post">
<template>
<style>
:host {
display: block;
position: relative;
background-color: white;
padding: 20px;
max-width: 450px;
min-width: 300px;
}
.card-header {
margin-bottom: 10px;
}
h2, h3 {
font-weight: 300;
}
h2 {
margin: 0;
font-size: 1.8rem;
}
h3 {
font-size: 1.2rem;
}
.timestamp {
font-size: 12px;
color: #BBB;
}
.card-header img {
width: 70px;
border-radius: 50%;
margin: 10px;
}
core-icon-button {
position: absolute;
top: 3px;
right: 3px;
}
</style>
<div class="container">
<div class="card-header" layout horizontal center>
<img src="{{post.thumbnail}}"/>
<div>
<h2>{{post.by}}</h2>
<span class="timestamp">6 minutes ago</span>
</div>
<core-icon-button
icon="favorite"
data-uid="{{post.uid}}"
on-tap="{{favoriteTapped}}">
</core-icon-button>
</div>
<div class="card-content">
<h3>{{post.title}}</h3>
</div>
</div>
</template>
<script>
Polymer('post-card', {
favoriteTapped: function(event, detail, sender) {
var uid = sender.getAttribute('data-uid');
this.fire('favorite-tap', {uid: uid});
}
});
</script>
</polymer-element>