@ucd-lib/theme-elements 1.1.0 → 1.1.1
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/brand/ucd-theme-header/ucd-theme-header.js +33 -1
- package/brand/ucd-theme-header/ucd-theme-header.tpl.js +47 -0
- package/brand/ucd-theme-primary-nav/ucd-theme-primary-nav.tpl.js +3 -0
- package/brand/ucd-theme-quick-links/ucd-theme-quick-links.tpl.js +3 -0
- package/package.json +1 -1
- package/ucdlib/ucdlib-author-profile/ucdlib-author-profile.tpl.js +2 -2
- package/ucdlib/ucdlib-branding-bar/ucdlib-branding-bar.js +6 -1
- package/ucdlib/ucdlib-sils-search-redirect/ucdlib-sils-search-redirect.tpl.js +6 -3
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
* @property {String} slogan - Optional text to display below site name
|
|
19
19
|
* @property {String} figureSrc - Site logo/icon to display next to site name
|
|
20
20
|
* @property {String} siteUrl - Url to use for links around site name and figure
|
|
21
|
+
* @property {Boolean} silenceWarnings - Console warnings will be silences
|
|
21
22
|
* @property {Boolean} opened - Whether header is open in the mobile view
|
|
22
23
|
* @property {Boolean} preventFixed - Navbar will not be fixed to top of screen in desktop view
|
|
23
24
|
*
|
|
@@ -49,6 +50,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
49
50
|
figureSrc: {type: String, attribute: "figure-src"},
|
|
50
51
|
siteUrl: {type: String, attribute: "site-url"},
|
|
51
52
|
opened: {type: Boolean},
|
|
53
|
+
silenceWarnings: {type: Boolean, attribute: 'silence-warnings'},
|
|
52
54
|
preventFixed: {type: Boolean, attribute: "prevent-fixed"},
|
|
53
55
|
isDemo: {type: Boolean, attribute: "is-demo"},
|
|
54
56
|
_transitioning: {type: Boolean, state: true},
|
|
@@ -57,6 +59,8 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
57
59
|
_hasQuickLinks: {type: Boolean, state: true},
|
|
58
60
|
_hasSearch: {type: Boolean, state: true},
|
|
59
61
|
_brandingBarInView: {type: Boolean, state: true},
|
|
62
|
+
_brandingBarLinks: {type: Array, state: true},
|
|
63
|
+
_brandingBarListener: {type: Boolean, state: true},
|
|
60
64
|
_components: {type: Object, state: true}
|
|
61
65
|
};
|
|
62
66
|
}
|
|
@@ -79,6 +83,7 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
79
83
|
this.figureSrc = "";
|
|
80
84
|
this.opened = false;
|
|
81
85
|
this.isDemo = false;
|
|
86
|
+
this.silenceWarnings = false;
|
|
82
87
|
|
|
83
88
|
this._transitioning = false;
|
|
84
89
|
this._hasPrimaryNav = false;
|
|
@@ -87,6 +92,8 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
87
92
|
this._hasSearch = false;
|
|
88
93
|
this._animationDuration = 500;
|
|
89
94
|
this._brandingBarInView = false;
|
|
95
|
+
this._brandingBarLinks = [];
|
|
96
|
+
this._brandingBarListener = false;
|
|
90
97
|
this._slottedComponents = {};
|
|
91
98
|
|
|
92
99
|
}
|
|
@@ -261,6 +268,21 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
261
268
|
|
|
262
269
|
}
|
|
263
270
|
|
|
271
|
+
/**
|
|
272
|
+
* @method _onBrandingBarUpdate
|
|
273
|
+
* @description Listens to nav item changes to the ucdlib-branding-bar element (if applicable)
|
|
274
|
+
* @private
|
|
275
|
+
* @param {Element} ele - ucdlib-branding-bar element
|
|
276
|
+
*/
|
|
277
|
+
_onBrandingBarUpdate(ele) {
|
|
278
|
+
if ( ele.navItems ) {
|
|
279
|
+
this._brandingBarLinks = ele.navItems;
|
|
280
|
+
} else {
|
|
281
|
+
this._brandingBarLinks = [];
|
|
282
|
+
}
|
|
283
|
+
console.log(ele.navItems);
|
|
284
|
+
}
|
|
285
|
+
|
|
264
286
|
/**
|
|
265
287
|
* @method _onChildListMutation
|
|
266
288
|
* @description Fires when there are changes to this element's non-shadow DOM children
|
|
@@ -273,7 +295,9 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
273
295
|
this._hasPrimaryNav = true;
|
|
274
296
|
this._slottedComponents.primaryNav = primaryNav;
|
|
275
297
|
} else {
|
|
276
|
-
|
|
298
|
+
if ( !this.silenceWarnings ) {
|
|
299
|
+
console.warn("No 'ucd-theme-primary-nav' child element found!");
|
|
300
|
+
}
|
|
277
301
|
this._hasPrimaryNav = false;
|
|
278
302
|
}
|
|
279
303
|
|
|
@@ -300,10 +324,18 @@ export default class UcdThemeHeader extends LitElement {
|
|
|
300
324
|
UcdlibBrandingBar.setAttribute('slot', 'branding-bar');
|
|
301
325
|
this._hasSlottedBranding = true;
|
|
302
326
|
this._slottedComponents.brandingBar = UcdlibBrandingBar;
|
|
327
|
+
if ( !this._brandingBarListener ){
|
|
328
|
+
this._onBrandingBarUpdate(UcdlibBrandingBar);
|
|
329
|
+
UcdlibBrandingBar.addEventListener('nav-update', (e) => {this._onBrandingBarUpdate(e.target);});
|
|
330
|
+
this._brandingBarListener = true;
|
|
331
|
+
}
|
|
332
|
+
|
|
303
333
|
} else if ( this.querySelector("*[slot='branding-bar']") ){
|
|
304
334
|
this._hasSlottedBranding = true;
|
|
335
|
+
this._brandingBarLinks = [];
|
|
305
336
|
} else {
|
|
306
337
|
this._hasSlottedBranding = false;
|
|
338
|
+
this._brandingBarLinks = [];
|
|
307
339
|
}
|
|
308
340
|
}
|
|
309
341
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { html, css } from 'lit';
|
|
2
2
|
import { classMap } from 'lit/directives/class-map.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
4
|
|
|
4
5
|
import headingStyles from "@ucd-lib/theme-sass/1_base_html/_headings.css.js";
|
|
5
6
|
import headerStyles from "@ucd-lib/theme-sass/4_component/_header.css.js";
|
|
@@ -40,6 +41,9 @@ export function styles() {
|
|
|
40
41
|
.fixed-mobile .l-header__branding {
|
|
41
42
|
margin-top: 55px;
|
|
42
43
|
}
|
|
44
|
+
.branding-bar-mobile-links {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
@media (min-width: 992px) {
|
|
@@ -51,6 +55,36 @@ export function styles() {
|
|
|
51
55
|
left: 0;
|
|
52
56
|
width: 100%;
|
|
53
57
|
}
|
|
58
|
+
.branding-bar-mobile-links {
|
|
59
|
+
display: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
.branding-bar-mobile-links ul {
|
|
63
|
+
margin: 0px;
|
|
64
|
+
padding: 0px;
|
|
65
|
+
list-style: none;
|
|
66
|
+
}
|
|
67
|
+
.branding-bar-mobile-links li {
|
|
68
|
+
margin: 0px;
|
|
69
|
+
padding: 0px;
|
|
70
|
+
list-style: none;
|
|
71
|
+
}
|
|
72
|
+
.branding-bar-mobile-links a {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
padding: 0.75rem;
|
|
76
|
+
border-bottom: 0.15rem solid rgb(219, 234, 247);
|
|
77
|
+
background-color: #fff;
|
|
78
|
+
color: rgb(2, 40, 81);
|
|
79
|
+
font-weight: 700;
|
|
80
|
+
line-height: 1.5rem;
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
}
|
|
83
|
+
.branding-bar-mobile-links a:hover {
|
|
84
|
+
background-color: rgb(255, 191, 0);
|
|
85
|
+
}
|
|
86
|
+
.branding-bar-mobile-links li:last-child a {
|
|
87
|
+
border-bottom: none;
|
|
54
88
|
}
|
|
55
89
|
|
|
56
90
|
`;
|
|
@@ -137,6 +171,19 @@ ${this.isDemo ? html`
|
|
|
137
171
|
<div class="l-nav-horizontal__primary-nav">
|
|
138
172
|
<slot name="primary-nav"></slot>
|
|
139
173
|
</div>
|
|
174
|
+
${this._brandingBarLinks.length ? html`
|
|
175
|
+
<div class='branding-bar-mobile-links'>
|
|
176
|
+
<ul>
|
|
177
|
+
${this._brandingBarLinks.map(link => html`
|
|
178
|
+
<li><a
|
|
179
|
+
href=${ifDefined(link.href ? link.href : null)}
|
|
180
|
+
target=${ifDefined(link.newTab ? "_blank": null)}
|
|
181
|
+
>${link.linkText}</a></li>
|
|
182
|
+
`)}
|
|
183
|
+
</ul>
|
|
184
|
+
|
|
185
|
+
</div>
|
|
186
|
+
` : html``}
|
|
140
187
|
</div>
|
|
141
188
|
</div>
|
|
142
189
|
</div>
|
package/package.json
CHANGED
|
@@ -92,7 +92,12 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
92
92
|
*/
|
|
93
93
|
_onChildListMutation(){
|
|
94
94
|
let navItems = this.parseNavChildren();
|
|
95
|
-
if ( navItems.length )
|
|
95
|
+
if ( navItems.length ) {
|
|
96
|
+
this.navItems = navItems;
|
|
97
|
+
} else {
|
|
98
|
+
this.navItems = [];
|
|
99
|
+
}
|
|
100
|
+
this.dispatchEvent(new CustomEvent('nav-update', {bubbles: true, composed: false}));
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
}
|
|
@@ -13,7 +13,7 @@ export function styles() {
|
|
|
13
13
|
const elementStyles = css`
|
|
14
14
|
:host {
|
|
15
15
|
display: block;
|
|
16
|
-
max-width:
|
|
16
|
+
max-width: 33rem;
|
|
17
17
|
margin: auto;
|
|
18
18
|
}
|
|
19
19
|
h2 {
|
|
@@ -44,8 +44,9 @@ export function styles() {
|
|
|
44
44
|
justify-content: space-between;
|
|
45
45
|
}
|
|
46
46
|
.search-options label {
|
|
47
|
-
|
|
47
|
+
font-weight: 700;
|
|
48
48
|
padding-bottom: 0;
|
|
49
|
+
color: ${unsafeCSS(categoryBrands.primary.hex)};
|
|
49
50
|
}
|
|
50
51
|
input[type=checkbox] {
|
|
51
52
|
margin-right: 0;
|
|
@@ -53,13 +54,15 @@ export function styles() {
|
|
|
53
54
|
.search-options button {
|
|
54
55
|
border: none;
|
|
55
56
|
background-color: inherit;
|
|
56
|
-
|
|
57
|
+
font-weight: 700;
|
|
57
58
|
text-decoration: underline;
|
|
58
59
|
padding: 0;
|
|
59
60
|
font-family: inherit;
|
|
61
|
+
color: ${unsafeCSS(categoryBrands.primary.hex)};
|
|
60
62
|
}
|
|
61
63
|
.checkbox label::before {
|
|
62
64
|
background-color: white;
|
|
65
|
+
border: 1px solid rgb(153, 153, 153);
|
|
63
66
|
}
|
|
64
67
|
.dark h2 {
|
|
65
68
|
color: ${unsafeCSS(categoryBrands.secondary.hex)}
|