added root path alias, icons, improved framework semantics

This commit is contained in:
Daniel Ledda
2022-02-27 22:59:30 +01:00
parent 352f6d6b9a
commit 7fca44f6c0
25 changed files with 207 additions and 284 deletions

View File

@@ -0,0 +1,34 @@
import UINode, {UINodeOptions} from "@/ui/UINode";
import "./Icon.css";
import List from "./svgs/list.svg";
import ArrowClockwise from "./svgs/arrow-clockwise.svg";
import Trash from "./svgs/trash.svg";
const IconUrlMap = {
arrowClockwise: ArrowClockwise,
list: List,
trash: Trash,
} as const;
export type IconName = keyof typeof IconUrlMap;
export type IconViewOptions = UINodeOptions & {
iconName: IconName,
};
export default class IconView extends UINode {
private iconUrl: string;
constructor(options: IconViewOptions) {
super(options);
this.iconUrl = IconUrlMap[options.iconName];
}
build(): HTMLSpanElement {
const icon = UINode.make("div", {
classes: ["icon-view"],
});
icon.style.cssText = `-webkit-mask-image: url(${this.iconUrl}); mask-image: url(${this.iconUrl});`;
return icon;
}
}