From 5404a95c15e176d25728bf1a319ddb9828b23625 Mon Sep 17 00:00:00 2001 From: Josh Kingsley Date: Sat, 25 Oct 2025 20:46:35 +0300 Subject: refactor(web): re-organize files --- web/src/components/grid/index.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 web/src/components/grid/index.ts (limited to 'web/src/components/grid/index.ts') diff --git a/web/src/components/grid/index.ts b/web/src/components/grid/index.ts new file mode 100644 index 0000000..18bf75a --- /dev/null +++ b/web/src/components/grid/index.ts @@ -0,0 +1,24 @@ +import h, { type CreateElement } from "../../html"; +import "./index.css"; +import colors from "open-color"; + +class NotiveGridElement extends HTMLElement { + canvasEl: HTMLCanvasElement = h.canvas(); + + connectedCallback() { + this.append(this.canvasEl); + this.draw(); + } + + draw() { + const ctx = this.canvasEl.getContext("2d"); + if (!ctx) throw new Error("Unable to get canvas context"); + ctx.fillStyle = colors.gray[8]; + ctx.fillRect(0, 0, this.canvasEl.width, this.canvasEl.height); + } +} + +customElements.define("ntv-grid", NotiveGridElement); + +export default ((...args: any[]): NotiveGridElement => + (h as any)["ntv-grid"](...args)) as CreateElement; -- cgit v1.2.3