Skip to content

Commit 5f20687

Browse files
committed
refactor: migrate menu-container HTML template to separate JS file and update component initialization
1 parent 0289d28 commit 5f20687

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

components/menu/menu-container/menu-container.html

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const HTML = `
2+
<link rel="stylesheet" href="__css__" />
3+
<slot></slot>
4+
`.replace("__css__", import.meta.url.replace(".html.js", ".css"));
5+

components/menu/menu-container/menu-container.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
import { ComponentModule } from "../../../src/modules/component.js";
21
import "../menu-item/menu-item.js";
32
import "../divider-item/divider-item.js";
43
import "../menu-label/menu-label.js";
54
import "../menu-group/menu-group.js";
5+
import { HTML } from "./menu-container.html.js";
66

77
class MenuContainer extends HTMLElement {
88
static name = Object.freeze("menu-container");
99

1010
constructor() {
1111
super();
1212
this.attachShadow({ mode: "open" });
13-
this.style.display = "none";
13+
this.shadowRoot.innerHTML = HTML;
1414
}
1515

1616
async connectedCallback() {
17-
this.shadowRoot.innerHTML = await ComponentModule.load_html({
18-
url: import.meta.url,
19-
});
20-
2117
await this.#initialize();
22-
this.style.display = "flex";
2318
}
2419

2520
async disconnectedCallback() {

0 commit comments

Comments
 (0)