forked from BrightspaceUILabs/navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d2l-navigation-link-image.js
62 lines (59 loc) · 1.36 KB
/
d2l-navigation-link-image.js
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
import './d2l-navigation-link.js';
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
/**
`d2l-navigation-link-image`
Polymer-based web component for the image link used in the navigational header.
@demo demo/d2l-navigation-button.html d2l-navigation-link-image
*/
class D2LNavigationLinkImage extends PolymerElement {
static get properties() {
return {
src: {
type: String
},
href: {
type: String
},
slim: {
reflectToAttribute: true,
type: Boolean,
value: false
},
text: {
type: String,
value: ''
}
};
}
static get template() {
const template = html`
<style>
:host {
display: inline-block;
height: 100%;
}
img {
vertical-align: middle;
border: none; /* needed for IE10 */
max-height: 60px;
max-width: 260px;
}
:host([slim]) img {
max-height: 40px;
max-width: 173px;
}
.d2l-navigation-link-image-container {
height: 100%;
vertical-align: middle;
align-items: center;
display: inline-flex;
}
</style>
<d2l-navigation-link href="[[href]]" text="[[text]]">
<span class="d2l-navigation-link-image-container"><img src="[[src]]" alt$="[[text]]"></span>
</d2l-navigation-link>`;
template.setAttribute('strip-whitespace', '');
return template;
}
}
customElements.define('d2l-navigation-link-image', D2LNavigationLinkImage);