Skip to content

Commit 0f8be74

Browse files
committed
Added navbar
1 parent 39a512c commit 0f8be74

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

src/component/nav/NavBarElement.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
import { LitElement, html, css } from 'lit';
3+
import Event from '../../core/event';
4+
5+
/**
6+
* NavBarElement
7+
*/
8+
export class NavBarElement extends LitElement {
9+
static get properties() {
10+
return {
11+
/**
12+
* Name of the button to use when firing the EVENT_CLICK event
13+
* @type {String}
14+
*/
15+
name: { type: String },
16+
17+
/**
18+
* Whether the button is disabled
19+
* @type {Boolean}
20+
*/
21+
disabled: { type: Boolean },
22+
};
23+
}
24+
25+
static get styles() {
26+
return css`
27+
:host nav {
28+
position: relative;
29+
padding: var(--navbar-padding);
30+
background-color: var(--navbar-background-color);
31+
color: var(--navbar-color);
32+
display: flex;
33+
flex-flow: row wrap;
34+
justify-content: space-between;
35+
align-items: center;
36+
border-bottom: var(--navbar-border-bottom);
37+
}
38+
`;
39+
}
40+
41+
render() {
42+
return html`
43+
<nav><ul><slot></slot></ul></nav>
44+
`;
45+
}
46+
47+
constructor() {
48+
super();
49+
// Default properties
50+
this.name = '';
51+
this.disabled = false;
52+
}
53+
54+
onClick() {
55+
this.dispatchEvent(new CustomEvent(
56+
Event.EVENT_CLICK, { detail: this.name },
57+
));
58+
}
59+
}
60+
61+
customElements.define('wc-navbar', NavBarElement);

src/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<link href="./index.css" rel="stylesheet">
99
</head>
1010
<body>
11+
<wc-navbar name="navbar"></wc-navbar>
12+
13+
1114
<div class="container">
1215
<h1>Button Group</h1>
1316
<wc-button-group>
@@ -32,5 +35,6 @@ <h1>Icon</h1>
3235
</div>
3336

3437

38+
3539
</body>
3640
</html>

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import './component/button/ButtonElement';
66
import './component/button/ButtonGroupElement';
77
import './component/button/CloseButtonElement';
88
import './component/icon/IconElement';
9+
import './component/nav/NavBarElement';
10+
911

1012
// CSS
1113
import './css/core.css';

0 commit comments

Comments
 (0)