-
Notifications
You must be signed in to change notification settings - Fork 31
/
nav.ts
74 lines (66 loc) · 1.77 KB
/
nav.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { sharedStyles } from "../style/shared";
import { AriaRole } from "../util/aria";
import { cssResult } from "../util/css";
import styles from "./nav.scss";
/**
* Properties of the nav.
*/
export interface INavProperties {
shadow: boolean;
fixed: boolean;
role: AriaRole;
}
/**
* Provide access to destinations in your app.
* @slot left - Content positioned to the left.
* @slot right - Content positioned to the right.
* @slot title - Title.
* @cssprop --nav-bg - Background
* @cssprop --nav-color - Color
* @cssprop --nav-padding - Padding
* @cssprop --nav-height - Height
* @cssprop --nav-elevation - Box shadow
* @cssprop --nav-transition - Transition
* @cssprop --nav-title-font-size - Font size of the title slot
* @cssprop --nav-title-font-weight - Font weight of the title slot
* @cssprop --nav-title-margin - Margin of the title slot
*/
@customElement("wl-nav")
export class Nav extends LitElement implements INavProperties {
static styles = [sharedStyles, cssResult(styles)];
/**
* Gives the nav a shadow.
* @attr
*/
@property({ type: Boolean, reflect: true }) shadow: boolean = false;
/**
* Fixes the nav to the top of the page.
* @attr
*/
@property({ type: Boolean, reflect: true }) fixed: boolean = false;
/**
* Role of the nav.
* @attr
*/
@property({ type: String, reflect: true }) role: AriaRole = "navigation";
/**
* Returns the template for the element.
*/
protected render(): TemplateResult {
return html`
<div id="left">
<slot name="left"></slot>
<slot name="title"></slot>
</div>
<div id="right">
<slot name="right"></slot>
</div>
`;
}
}
declare global {
interface HTMLElementTagNameMap {
"wl-nav": Nav;
}
}