created base layouts and fixed structure

This commit is contained in:
Fran Jurmanović
2021-05-29 12:11:04 +02:00
parent 95a729d7d0
commit 4a675ac198
16 changed files with 160 additions and 12 deletions

View File

@@ -0,0 +1,27 @@
import { target } from "@github/catalyst";
class BaseLayoutElement extends HTMLElement {
@target slotted: HTMLElement;
public isLayout: boolean = true;
constructor() {
super();
}
get slotTag() {
return this.slotted?.firstElementChild?.tagName;
}
compareTags = (tag: string | HTMLElement): boolean => {
if (typeof tag === "string") {
return this.slotTag === tag;
}
return tag?.tagName === this.slotTag;
};
setElement = (newTag: string) => {
console.log(this.innerHTML);
this.slotted.innerHTML = `<${newTag}></${newTag}>`;
};
}
export default BaseLayoutElement;