From 8cc5a50b91a3d80b28b03191b246974d3aca9bf8 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 25 Jan 2022 20:58:57 +0100 Subject: polish + menu --- source/client/menu.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 source/client/menu.ts (limited to 'source/client/menu.ts') diff --git a/source/client/menu.ts b/source/client/menu.ts new file mode 100644 index 0000000..1401b42 --- /dev/null +++ b/source/client/menu.ts @@ -0,0 +1,26 @@ +import { Room } from "./room.ts"; + +export function create_menu(room?: Room) { + const menu = document.createElement("div") + menu.classList.add("menu-overlay") + document.body.append(menu) + + const item = (name: string, cb: (() => void) | string) => { + const p = document.createElement("p") + const a = document.createElement("a") + a.classList.add("menu-item") + a.textContent = name + if (typeof cb == "string") a.href = cb + else a.addEventListener("click", cb), a.href = "#" + p.append(a) + return p + } + + if (room) menu.append( + item("Settings", () => alert("todo, refer to the url parameters in the docs for now")) + ) + menu.append( + item("Licence", "/licence"), + item("Sources / Documentation", "https://codeberg.org/metamuffin/keks-meet"), + ) +} \ No newline at end of file -- cgit v1.2.3-70-g09d2