-
Notifications
You must be signed in to change notification settings - Fork 0
/
subreddit-list.html
38 lines (36 loc) · 1 KB
/
subreddit-list.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
<link rel="import" href="../bower_components/polymer/polymer.html">
<!-- subreddit-list -->
<polymer-element name="subreddit-list" attributes="subreddits">
<template>
<style>
:host {
color: #565A5C;
}
paper-item.core-selected {
background-color: #72B9BF;
color: white;
}
</style>
<core-menu>
<paper-item id="frontpage" on-Click="{{onClick}}"">Frontpage</paper-item>
<template repeat="{{subreddit in subreddits}}">
<paper-item on-click="{{onClick}}">{{subreddit.url}}</paper-item>
</template>
</core-menu>
</template>
<script>
Polymer({
created: function() {
this.subreddits = [];
},
onClick: function(event, detail, sender) {
if (event.target === this.$.frontpage) {
this.fire('frontpage-selected', {});
} else {
this.fire('subreddit-selected',
{subreddit: event.target.templateInstance.model.subreddit});
}
}
});
</script>
</polymer-element>