-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnavigation.html
executable file
·82 lines (70 loc) · 1.64 KB
/
navigation.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
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="color-band.html">
<link rel="import" href="links.html">
<link rel="import" href="logo.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<dom-module id="brightspace-navigation">
<style>
:host {
background-color: #fff;
border-bottom: 1px solid #e6eaf0;
display: block;
position: relative;
}
navigation-logo, navigation-links {
opacity: 0;
transition: opacity 1000ms;
}
:host[loaded] navigation-logo,
:host[loaded] navigation-links {
opacity: 1;
}
hr {
border-bottom: none;
border-top: 1px solid #e6eaf0;
margin: 0;
}
</style>
<template>
<iron-ajax
url="{{endpoint}}"
handle-as="json"
loading="{loading}"
last-response="{{response}}"
on-response="handleResponse"></iron-ajax>
<nav>
<navigation-color-band color="[[response.color]]"></navigation-color-band>
<navigation-logo
src="[[response.logo]]"
text="[[response.orgUnitName]]"></navigation-logo>
<hr />
<dom-if if="{!loading}">
<navigation-links links="[[response.links]]"></navigation-links>
</dom-if>
</nav>
</template>
</dom-module>
<script>
Polymer({
is: 'brightspace-navigation',
properties: {
endpoint: {
type: String
},
loading: {
type: Boolean,
value: true
}
},
ready: function() {
// TODO: just to similuate slowness, this should be removed
// and "auto" attribute should be added to <iron-ajax>
setTimeout(function() {
this.$$('iron-ajax').generateRequest();
}.bind(this), 300);
},
handleResponse: function() {
this.setAttribute('loaded', '');
}
});
</script>