@@ -5,11 +5,12 @@ const classNames = require('classnames');
5
5
6
6
import { store } from '../../store.js' ; // connect to redux
7
7
import { BaseComponent } from '../base-component.js' ;
8
- import MenuIcon from '../../../icons/menu.svg' ;
9
- import VisuallyHidden from '@reach/visually-hidden' ;
8
+
9
+ import { html } from 'lit-html' ;
10
+ import { BaseLitComponent } from '../base-component.js' ;
10
11
11
12
@define
12
- class Header extends BaseComponent {
13
+ class Header extends BaseLitComponent {
13
14
static is = 'pl-header' ;
14
15
15
16
constructor ( self ) {
@@ -42,33 +43,55 @@ class Header extends BaseComponent {
42
43
navTarget . classList . toggle ( 'pl-is-active' ) ; // @todo : refactor to have this add based on the component's state
43
44
}
44
45
45
- render ( { themeMode } ) {
46
- return (
46
+ render ( ) {
47
+ return html `
47
48
< header class ="pl-c-header " role ="banner ">
48
49
< button
49
50
class ="pl-c-header__nav-toggle pl-js-nav-trigger "
50
- onClick = { this . toggleNav }
51
+ @click =" $ {this . toggleNav } "
51
52
>
52
- < MenuIcon height = { 20 } width = { 20 } fill = "currentColor" />
53
- < VisuallyHidden > Menu</ VisuallyHidden >
53
+ < pl-icon
54
+ name ="menu "
55
+ height ="20 "
56
+ width ="20 "
57
+ fill ="currentColor "
58
+ > </ pl-icon >
59
+ < span class ="is-vishidden "> Menu</ span >
54
60
</ button >
55
61
56
- < pl-logo
57
- src = { `styleguide/images/pattern-lab-logo--on-${ themeMode } .svg` }
58
- url = "/"
59
- text = "Pattern Lab"
60
- />
62
+ ${ window . config ?. theme ?. logo !== false
63
+ ? html `
64
+ < pl-logo
65
+ src-light ="${ window . config ?. theme ?. logo ?. srcLight ||
66
+ 'styleguide/images/pattern-lab-logo--on-light.svg' } "
67
+ src-dark ="${ window . config ?. theme ?. logo ?. srcDark ||
68
+ 'styleguide/images/pattern-lab-logo--on-dark.svg' } "
69
+ url ="${ window . config ?. theme ?. logo ?. url === '' ||
70
+ window . config ?. theme ?. logo ?. url === 'none'
71
+ ? ''
72
+ : window . config ?. theme ?. logo ?. url || '/' } "
73
+ alt-text ="${ window . config ?. theme ?. logo ?. altText || '' } "
74
+ theme ="${ this . themeMode } "
75
+ ratio ="${ window . config ?. theme ?. logo ?. ratio || '' } "
76
+ text ="${ window . config ?. theme ?. logo ?. text === '' ||
77
+ window . config ?. theme ?. logo ?. text === false ||
78
+ window . config ?. theme ?. logo ?. text === 'none'
79
+ ? ''
80
+ : window . config ?. theme ?. logo ?. text || 'Pattern Lab' } "
81
+ > </ pl-logo >
82
+ `
83
+ : '' }
61
84
62
85
< nav
63
86
class ="pl-c-nav pl-js-nav-target pl-js-nav-container "
64
87
role ="navigation "
65
88
>
66
- < pl-search max-results = "10" placeholder = "Find a Pattern" / >
67
- < pl-nav / >
89
+ < pl-search max-results ="10 " placeholder ="Find a Pattern "> </ pl-search >
90
+ < pl-nav > </ pl-nav >
68
91
</ nav >
69
92
< pl-controls > </ pl-controls >
70
93
</ header >
71
- ) ;
94
+ ` ;
72
95
}
73
96
}
74
97
0 commit comments