-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathSidebar.ts
More file actions
60 lines (50 loc) · 1.77 KB
/
Copy pathSidebar.ts
File metadata and controls
60 lines (50 loc) · 1.77 KB
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
import "#elements/sidebar/SidebarVersion";
import { AKElement } from "#elements/Base";
import Styles from "#elements/sidebar/Sidebar.css";
import { msg } from "@lit/localize";
import { CSSResult, html, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators.js";
import PFNav from "@patternfly/patternfly/components/Nav/nav.css";
import PFPage from "@patternfly/patternfly/components/Page/page.css";
@customElement("ak-sidebar")
export class Sidebar extends AKElement {
static styles: CSSResult[] = [
// ---
PFPage,
PFNav,
Styles,
];
@property({ type: Boolean })
public hidden = false;
protected defaultSlot: HTMLSlotElement;
protected beforeItemsSlot: HTMLSlotElement;
constructor() {
super();
this.defaultSlot = this.ownerDocument.createElement("slot");
this.beforeItemsSlot = this.ownerDocument.createElement("slot");
this.beforeItemsSlot.name = "before-items";
}
render(): TemplateResult {
return html`<div part="nav" class="pf-c-nav" role="presentation">
${this.beforeItemsSlot}
<ul
id="global-nav"
?hidden=${this.hidden}
aria-label=${msg("Global navigation")}
role="navigation"
class="pf-c-nav__list ak-m-thin-scrollbar ak-m-scroll-shadows"
part="list"
>
${this.defaultSlot}
</ul>
<ak-sidebar-version
exportparts="trigger:about-dialog-trigger, button-content:about-dialog-button-content, product-name, product-version"
></ak-sidebar-version>
</div>`;
}
}
declare global {
interface HTMLElementTagNameMap {
"ak-sidebar": Sidebar;
}
}