-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatest-posts.html
More file actions
executable file
·117 lines (91 loc) · 2.57 KB
/
latest-posts.html
File metadata and controls
executable file
·117 lines (91 loc) · 2.57 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
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
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../../bower_components/marked-element/marked-element.html">
<link rel="import" href="../behaviors/utils-behavior.html">
<link rel="import" href="../styles/shared-styles.html">
<dom-module id="latest-posts">
<template>
<style include="shared-styles">
:host {
display: block;
background: #fff;
}
.posts-wrapper {
@apply(--layout-vertical);
}
.post {
@apply(--layout-flex-5);
}
.post:not(:first-of-type) {
margin-top: 30px;
}
.title {
color: var(--default-primary-color);
font-size: 24px;
line-height: 1.2
}
a {
color: var(--default-primary-color);
font-size: 16px;
}
@media (min-width: 601px) {
.posts-wrapper {
@apply(--layout-horizontal);
}
.post:not(:first-of-type) {
margin-top: 0;
}
.post-divider {
@apply(--layout-flex);
}
}
</style>
<div class="container">
<h4 class="heading text-center">{$ latestNews $}</h4>
<div class="posts-wrapper">
<div class="post">
<div class="title">[[_posts.0.title]]</div>
<marked-element markdown="[[_posts.0.brief]]">
<div class="markdown-html"></div>
</marked-element>
<a href$="[[_posts.0.url]]">{$ continueReading $}</a>
</div>
<span class="post-divider"></span>
<div class="post">
<div class="title">[[_posts.1.title]]</div>
<marked-element markdown="[[_posts.1.brief]]">
<div class="markdown-html"></div>
</marked-element>
<a href$="[[_posts.1.url]]">{$ continueReading $}</a>
</div>
</div>
</div>
</template>
<script>
(function () {
'use strict';
Polymer({
is: 'latest-posts',
behaviors: [
HOVERBOARD.UtilsBehavior
],
properties: {
posts: {
type: Array,
observer: '_postsChanged'
},
_posts: {
type: Array
}
},
_postsChanged: function () {
var temp = this.posts.slice(0, 2);
for (var i = 0, len = temp.length; i < len; i++) {
temp[i].url = '/blog/posts/' + temp[i].id + '/';
}
this._posts = temp;
}
});
}());
</script>
</dom-module>