@ucd-lib/theme-elements 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -9,12 +9,13 @@ import bookLogo from "./book.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* @class UcdlibBrandingBar
|
|
11
11
|
* @classdesc Component class for displaying a Library branding bar in a header
|
|
12
|
-
*
|
|
13
|
-
* @property {String} figure - Figure to display: 'book' or '
|
|
12
|
+
*
|
|
13
|
+
* @property {String} figure - Figure to display: 'book', 'logo', or 'custom'
|
|
14
|
+
* @property {String} figureSrc - Url of image to use for custom figure
|
|
14
15
|
* @property {String} siteName - Name of website to display
|
|
15
16
|
* @property {String} slogan - Optional text to display below site name
|
|
16
17
|
* @property {String} siteUrl - Url to use for links around site name and figure
|
|
17
|
-
*
|
|
18
|
+
*
|
|
18
19
|
* @examples
|
|
19
20
|
* <ucdlib-branding-bar>
|
|
20
21
|
* <a href="#">My Account</a>
|
|
@@ -28,7 +29,8 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
28
29
|
static get properties() {
|
|
29
30
|
return {
|
|
30
31
|
figure: {type: String},
|
|
31
|
-
|
|
32
|
+
figureSrc: {type: String, attribute: "figure-src"},
|
|
33
|
+
figureCustomWidth: {type: String, attribute: "figure-custom-width"},
|
|
32
34
|
siteName: {type: String, attribute: "site-name"},
|
|
33
35
|
slogan: {type: String},
|
|
34
36
|
siteUrl: {type: String, attribute: "site-url"},
|
|
@@ -49,6 +51,8 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
49
51
|
);
|
|
50
52
|
|
|
51
53
|
this.figure = "book";
|
|
54
|
+
this.figureSrc = '';
|
|
55
|
+
this.figureCustomWidth = '150px';
|
|
52
56
|
this.siteName = "UC Davis Library";
|
|
53
57
|
this.slogan = "";
|
|
54
58
|
this.siteUrl = "/";
|
|
@@ -81,7 +85,7 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
81
85
|
*/
|
|
82
86
|
_renderFigure(){
|
|
83
87
|
if( this.figure === 'custom' ) {
|
|
84
|
-
return html`<img src="${this.
|
|
88
|
+
return html`<img src="${this.figureSrc}" />`;
|
|
85
89
|
}
|
|
86
90
|
if ( this.figure === 'logo') return logo;
|
|
87
91
|
if ( this.figure === 'book' ) return bookLogo;
|
|
@@ -106,4 +110,4 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
106
110
|
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
customElements.define('ucdlib-branding-bar', UcdlibBrandingBar);
|
|
113
|
+
customElements.define('ucdlib-branding-bar', UcdlibBrandingBar);
|
|
@@ -27,10 +27,6 @@ export function styles() {
|
|
|
27
27
|
width: 70px;
|
|
28
28
|
min-width: 70px;
|
|
29
29
|
}
|
|
30
|
-
.figure--custom img {
|
|
31
|
-
width: 150px;
|
|
32
|
-
min-width: 150px;
|
|
33
|
-
}
|
|
34
30
|
.figure--logo svg {
|
|
35
31
|
width: 375px;
|
|
36
32
|
min-width: 375px;
|
|
@@ -66,7 +62,7 @@ export function styles() {
|
|
|
66
62
|
display: none;
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
|
|
65
|
+
|
|
70
66
|
`;
|
|
71
67
|
|
|
72
68
|
return [
|
|
@@ -76,8 +72,14 @@ export function styles() {
|
|
|
76
72
|
elementStyles];
|
|
77
73
|
}
|
|
78
74
|
|
|
79
|
-
export function render() {
|
|
75
|
+
export function render() {
|
|
80
76
|
return html`
|
|
77
|
+
<style>
|
|
78
|
+
.figure--custom img {
|
|
79
|
+
width: ${this.figureCustomWidth};
|
|
80
|
+
min-width: ${this.figureCustomWidth};
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
81
83
|
<div class="container figure--${this.figure}">
|
|
82
84
|
<div class="site-branding">
|
|
83
85
|
<div class="site-branding__figure">
|
|
@@ -93,7 +95,7 @@ return html`
|
|
|
93
95
|
${this.navItems.length ? html`
|
|
94
96
|
<nav class="menu">
|
|
95
97
|
${this.navItems.map(link => html`
|
|
96
|
-
<a
|
|
98
|
+
<a
|
|
97
99
|
href=${ifDefined(link.href ? link.href : null)}
|
|
98
100
|
target=${ifDefined(link.newTab ? "_blank": null)}
|
|
99
101
|
>${link.linkText}</a>
|
|
@@ -103,4 +105,4 @@ return html`
|
|
|
103
105
|
|
|
104
106
|
</div>
|
|
105
107
|
|
|
106
|
-
`;}
|
|
108
|
+
`;}
|