Skip to content

Commit 2c28c32

Browse files
committed
refactor: migrate menu-label HTML template to separate JS file and update component initialization
1 parent a4644da commit 2c28c32

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

components/menu/menu-label/menu-label.html

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

components/menu/menu-label/menu-label.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
import { ComponentModule } from "../../../src/modules/component.js";
1+
import { HTML } from "./menu-label.html.js";
22

33
class MenuLabel extends HTMLElement {
44
static name = Object.freeze("menu-label");
55

66
constructor() {
77
super();
88
this.attachShadow({ mode: "open" });
9-
this.style.display = "none";
10-
}
11-
12-
async connectedCallback() {
13-
this.shadowRoot.innerHTML = await ComponentModule.load_html({
14-
url: import.meta.url,
15-
});
16-
17-
this.style.display = "flex";
9+
this.shadowRoot.innerHTML = HTML;
1810
}
1911
}
2012

0 commit comments

Comments
 (0)