mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
created base layouts and fixed structure
This commit is contained in:
27
src/common/layouts/BaseLayoutElement/BaseLayoutElement.ts
Normal file
27
src/common/layouts/BaseLayoutElement/BaseLayoutElement.ts
Normal 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;
|
||||
Reference in New Issue
Block a user