@ucd-lib/theme-elements 1.2.4 → 1.2.6
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 +1 -1
- package/ucdlib/ucdlib-branding-bar/ucdlib-branding-bar.js +6 -2
- package/ucdlib/ucdlib-branding-bar/ucdlib-branding-bar.tpl.js +4 -0
- package/ucdlib/ucdlib-header/ucdlib-header.js +18 -0
- package/ucdlib/ucdlib-header/ucdlib-header.tpl.js +32 -11
- package/ucdlib/ucdlib-primary-nav/ucdlib-primary-nav.tpl.js +0 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, svg } from 'lit';
|
|
1
|
+
import { LitElement, html, svg } from 'lit';
|
|
2
2
|
import {render, styles} from "./ucdlib-branding-bar.tpl.js";
|
|
3
3
|
|
|
4
4
|
import {Mixin, NavElement} from "../../utils/mixins";
|
|
@@ -28,6 +28,7 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
28
28
|
static get properties() {
|
|
29
29
|
return {
|
|
30
30
|
figure: {type: String},
|
|
31
|
+
figureUrl: {type: String, attribute: "figure-url"},
|
|
31
32
|
siteName: {type: String, attribute: "site-name"},
|
|
32
33
|
slogan: {type: String},
|
|
33
34
|
siteUrl: {type: String, attribute: "site-url"},
|
|
@@ -62,7 +63,7 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
62
63
|
*/
|
|
63
64
|
willUpdate(props){
|
|
64
65
|
if ( props.has("figure") && props.get("figure") !== undefined ){
|
|
65
|
-
const allowedKeywords = ['book', 'logo'];
|
|
66
|
+
const allowedKeywords = ['book', 'logo', 'custom'];
|
|
66
67
|
if ( !allowedKeywords.includes(props.get('figure')) ){
|
|
67
68
|
console.warn(`${props.get('figure')} is not a recognized "figure" keyword.
|
|
68
69
|
Allowed values: ${JSON.stringify(allowedKeywords)}
|
|
@@ -79,6 +80,9 @@ export default class UcdlibBrandingBar extends Mixin(LitElement)
|
|
|
79
80
|
* @returns {TemplateResult}
|
|
80
81
|
*/
|
|
81
82
|
_renderFigure(){
|
|
83
|
+
if( this.figure === 'custom' ) {
|
|
84
|
+
return html`<img src="${this.figureUrl}" />`;
|
|
85
|
+
}
|
|
82
86
|
if ( this.figure === 'logo') return logo;
|
|
83
87
|
if ( this.figure === 'book' ) return bookLogo;
|
|
84
88
|
return svg``;
|
|
@@ -23,6 +23,10 @@ import {
|
|
|
23
23
|
* <a href="#">LINK 2</a>
|
|
24
24
|
* <a href="#">LINK 3</a>
|
|
25
25
|
* </ucd-theme-primary-nav>
|
|
26
|
+
* <ucd-theme-search-popup>
|
|
27
|
+
* <ucd-theme-search-form>
|
|
28
|
+
* </ucd-theme-search-form>
|
|
29
|
+
* </ucd-theme-search-popup>
|
|
26
30
|
* </ucdlib-header>
|
|
27
31
|
*
|
|
28
32
|
*/
|
|
@@ -38,6 +42,7 @@ export default class UcdlibHeader extends LitElement {
|
|
|
38
42
|
isDemo: {type: Boolean, attribute: "is-demo"},
|
|
39
43
|
_transitioning: {type: Boolean, state: true},
|
|
40
44
|
_hasPrimaryNav: {type: Boolean, state: true},
|
|
45
|
+
_hasQuickLinks: {type: Boolean, state: true},
|
|
41
46
|
_hasSearch: {type: Boolean, state: true},
|
|
42
47
|
_components: {type: Object, state: true}
|
|
43
48
|
};
|
|
@@ -63,6 +68,7 @@ export default class UcdlibHeader extends LitElement {
|
|
|
63
68
|
|
|
64
69
|
this._transitioning = false;
|
|
65
70
|
this._hasPrimaryNav = false;
|
|
71
|
+
this._hasQuickLinks = false;
|
|
66
72
|
this._hasSearch = false;
|
|
67
73
|
this._animationDuration = 500;
|
|
68
74
|
this._slottedComponents = {};
|
|
@@ -74,6 +80,9 @@ export default class UcdlibHeader extends LitElement {
|
|
|
74
80
|
*/
|
|
75
81
|
_onLocationChange(){
|
|
76
82
|
this.close();
|
|
83
|
+
if ( this._hasQuickLinks ){
|
|
84
|
+
this._slottedComponents.quickLinks.close();
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
/**
|
|
@@ -200,6 +209,15 @@ export default class UcdlibHeader extends LitElement {
|
|
|
200
209
|
}
|
|
201
210
|
this._hasPrimaryNav = false;
|
|
202
211
|
}
|
|
212
|
+
|
|
213
|
+
let search = this.querySelector('ucd-theme-search-popup');
|
|
214
|
+
if ( search ) {
|
|
215
|
+
search.setAttribute('slot', 'search');
|
|
216
|
+
this._hasSearch = true;
|
|
217
|
+
this._slottedComponents.search = search;
|
|
218
|
+
} else {
|
|
219
|
+
this._hasSearch = false;
|
|
220
|
+
}
|
|
203
221
|
}
|
|
204
222
|
|
|
205
223
|
}
|
|
@@ -8,7 +8,7 @@ import headerLayoutStyles from "@ucd-lib/theme-sass/5_layout/_l-header.css.js"
|
|
|
8
8
|
import brandingStyles from "@ucd-lib/theme-sass/4_component/_site-branding.css.js"
|
|
9
9
|
import mobileBarStyles from "@ucd-lib/theme-sass/4_component/_mobile-bar.css.js";
|
|
10
10
|
import navToggleStyles from "@ucd-lib/theme-sass/4_component/_nav-toggle.css.js"
|
|
11
|
-
|
|
11
|
+
import offCanvasStyles from "@ucd-lib/theme-sass/4_component/_nav-off-canvas.css.js"
|
|
12
12
|
|
|
13
13
|
export function styles() {
|
|
14
14
|
const elementStyles = css`
|
|
@@ -40,16 +40,18 @@ export function styles() {
|
|
|
40
40
|
|
|
41
41
|
.logo-container {
|
|
42
42
|
display: flex;
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.website-link-container {
|
|
47
|
+
padding-left: 0.5rem;
|
|
43
48
|
background-color: #13639E;
|
|
44
|
-
clip-path: polygon(1rem 0px, 110% 0px, 110%
|
|
49
|
+
clip-path: polygon(1rem 0px, 110% 0px, 110% 104%, 0% 104%);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
.
|
|
48
|
-
width: 1rem;
|
|
52
|
+
.website-link-container::before {
|
|
49
53
|
margin-left: 0.5rem;
|
|
50
|
-
background-color: #14447A;
|
|
51
54
|
content: "";
|
|
52
|
-
transform: skewX(-16deg);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
.logo-link::before {
|
|
@@ -57,10 +59,18 @@ export function styles() {
|
|
|
57
59
|
color: white;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
.
|
|
62
|
+
.website-link-container:hover {
|
|
61
63
|
background-color: #FFBF00;
|
|
64
|
+
}
|
|
62
65
|
|
|
66
|
+
.logo-border {
|
|
67
|
+
background-color: #14447A;
|
|
68
|
+
width: 1rem;
|
|
69
|
+
transform: skewX(-16deg);
|
|
70
|
+
position: relative;
|
|
71
|
+
left: 0.55rem;
|
|
63
72
|
}
|
|
73
|
+
|
|
64
74
|
.logo-link img {
|
|
65
75
|
fill: #FFFFFF;
|
|
66
76
|
}
|
|
@@ -92,7 +102,8 @@ export function styles() {
|
|
|
92
102
|
brandingStyles,
|
|
93
103
|
mobileBarStyles,
|
|
94
104
|
navToggleStyles,
|
|
95
|
-
|
|
105
|
+
offCanvasStyles,
|
|
106
|
+
elementStyles,
|
|
96
107
|
];
|
|
97
108
|
}
|
|
98
109
|
|
|
@@ -211,6 +222,7 @@ ${this.isDemo ? html`
|
|
|
211
222
|
}
|
|
212
223
|
.menu--hidden .off-canvas__container {
|
|
213
224
|
display: grid;
|
|
225
|
+
grid-template-areas: "nav quick search logo";
|
|
214
226
|
}
|
|
215
227
|
.l-nav-horizontal {
|
|
216
228
|
display: grid;
|
|
@@ -268,10 +280,19 @@ ${this.isDemo ? html`
|
|
|
268
280
|
<div>
|
|
269
281
|
<slot name="primary-nav"></slot>
|
|
270
282
|
</div>
|
|
283
|
+
${this._hasSearch ? html`
|
|
284
|
+
<div class="l-nav-horizontal__search-popup">
|
|
285
|
+
<slot name="search"></slot>
|
|
286
|
+
</div>
|
|
287
|
+
` : html``}
|
|
288
|
+
|
|
271
289
|
<div class="logo-container">
|
|
272
|
-
<
|
|
273
|
-
|
|
274
|
-
|
|
290
|
+
<div ?hidden=${this._hasSearch} class="logo-border"></div>
|
|
291
|
+
<div class="website-link-container">
|
|
292
|
+
<a class="logo-link" href="https://www.ucdavis.edu/" aria-label="UC Davis main website link">
|
|
293
|
+
<div class="ucd-logo"></div>
|
|
294
|
+
</a>
|
|
295
|
+
</div>
|
|
275
296
|
</div>
|
|
276
297
|
|
|
277
298
|
</div>
|