瀏覽代碼

feat(ui): add new components

This commit adds the following components:
- Glyph
KernelDeimos 1 年之前
父節點
當前提交
38ba42575c
共有 2 個文件被更改,包括 29 次插入0 次删除
  1. 28 0
      src/UI/Components/Glyph.js
  2. 1 0
      src/init_async.js

+ 28 - 0
src/UI/Components/Glyph.js

@@ -0,0 +1,28 @@
+import { Component } from "../../util/Component.js";
+
+export default def(class Glyph extends Component {
+    static ID = 'ui.component.Glyph';
+
+    static PROPERTIES = {
+        size: {
+            value: 24,
+        },
+        codepoint: {
+            value: '✅',
+        },
+    }
+
+    static CSS = `
+        div {
+            text-align: center;
+        }
+    `;
+
+    create_template ({ template }) {
+        template.innerHTML = /*html*/`
+            <div style="font-size: ${this.get('size')}px;">
+                ${this.get('codepoint')}
+            </div>
+        `;
+    }
+});

+ 1 - 0
src/init_async.js

@@ -3,6 +3,7 @@ logger.info('start -> async initialization');
 
 import './util/TeePromise.js';
 import './util/Component.js';
+import './UI/Components/Glyph.js';
 
 logger.info('end -> async initialization');
 globalThis.init_promise.resolve();