This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
topeka-categories.html
132 lines (109 loc) · 5.7 KB
/
topeka-categories.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="avatars.html">
<link rel="import" href="category-images.html">
<link rel="import" href="category-icons.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-selector/core-selector.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="topeka-categories" attributes="user categories category wide allScores" vertical layout>
<template>
<link rel="stylesheet" href="topeka-categories.css">
<link rel="stylesheet" href="topeka-category-themes.css">
<div class="categories-panel" flex auto>
<core-toolbar class="category-toolbar" slide-down?="{{parentElement.selected !== 'category' && parentElement.lastSelected !== 'category'}}">
<core-icon icon="avatars:avatar-{{user.avatar}}" class="topeka-avatar"></core-icon>
<div flex class="user-name">{{user.name}}</div>
<div>{{user.score}} pts</div>
</core-toolbar>
<core-selector class="category-list content {{ {wide: wide} | tokenList }}" selected="{{selected}}" tile-cascade?="{{parentElement.selected !== 'category' && parentElement.lastSelected !== 'category'}}" fade?="{{parentElement.lastSelected === 'splash'}}">
<div class="category-item leaderboard" vertical layout>
<div class="tile theme-bg-a" dummy fit></div>
<div class="tile" flex vertical layout>
<div flex relative>
<!-- sizing wrapper -->
<div fit layout vertical center center-justified>
<div class="category-bg-wrapper" relative>
<core-icon icon="category-icons:leaderboard" class="category-tile-bg" fit></core-icon>
</div>
</div>
</div>
<div class="cat-name" horizontal center layout>
<div flex>Leaderboard</div>
<core-icon class="category-icon" icon="arrow-forward"></core-icon>
</div>
</div>
</div>
<template repeat="{{cat, i in categories}}">
<template bind="{{allScores[cat.name] as scores}}">
<div class="category-item {{cat.theme}}-theme {{ {completed: scores.length == cat.quizzes.length} | tokenList }}" vertical layout needZ?="{{category.name === cat.name}}">
<div class="tile theme-bg-a" dummy fit hero-id="{{category.name === cat.name ? 'punch' : ''}}" hero?="{{category.name === cat.name}}"></div>
<div class="tile" flex auto vertical layout>
<div flex auto relative>
<!-- sizing wrapper -->
<div fit layout vertical center center-justified>
<div class="category-bg-wrapper" relative>
<core-icon class="category-tile-bg {{ {'theme-icon': scores.length === cat.quizzes.length} | tokenList }}" icon="{{scores.length === cat.quizzes.length ? 'check' : 'category-icons:' + cat.id}}" cross-fade-delayed?="{{category.name === cat.name && parentElement.lastSelected === 'category'}}" fit></core-icon>
</div>
</div>
</div>
<div class="cat-name theme-bg" horizontal center layout hero-id="{{category.name === cat.name ? 'punch-bottom' : ''}}" hero?="{{category.name === cat.name}}">
<div flex>
<span cross-fade-delayed?="{{category.name === cat.name && parentElement.lastSelected === 'category'}}">{{cat.name}}</span>
</div>
<core-icon class="category-icon theme-bg" icon="av:play-arrow" hidden?="{{scores.length === cat.quizzes.length}}" cross-fade-delayed?="{{category.name === cat.name && parentElement.lastSelected === 'category'}}"></core-icon>
</div>
</div>
</div>
</template>
</template>
<div class="category-item profile" vertical layout>
<div class="tile theme-bg-a" dummy fit></div>
<div class="tile" flex auto vertical layout>
<div flex auto relative>
<!-- sizing wrapper -->
<div fit layout vertical center center-justified>
<div class="category-bg-wrapper" relative>
<core-icon icon="category-icons:profile" class="category-tile-bg" fit></core-icon>
</div>
</div>
</div>
<div class="cat-name" horizontal center layout>
<div flex>Profile</div>
<core-icon class="category-icon" icon="arrow-forward"></core-icon>
</div>
</div>
</div>
<div class="category-item polymer-logo" hidden?="{{wide}}" vertical layout>
<div class="tile" fit>
<core-icon icon="category-icons:polymer"></core-icon>
</div>
</div>
</core-selector>
</div>
</template>
<script>
Polymer('topeka-categories', {
wide: false,
created: function() {
this.categories = [];
},
selectedChanged: function() {
// first one is leaderboard, last one is profile
if (this.selected === 0) {
this.category = {name: 'leaderboard'};
} else if (this.selected === this.categories.length + 1) {
this.category = {name: 'profile'};
} else {
this.category = this.categories[this.selected - 1];
}
}
});
</script>
</polymer-element>