From 0ba9de1b09bf82b1ecc696c6071aab0f4878588f Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Mon, 3 Mar 2025 18:46:09 +0100 Subject: [PATCH] Navbar styles --- src/back/routes/common/navbar.ts | 18 ++++++++++++------ src/main.css | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/back/routes/common/navbar.ts b/src/back/routes/common/navbar.ts index 28af33f..29797aa 100644 --- a/src/back/routes/common/navbar.ts +++ b/src/back/routes/common/navbar.ts @@ -1,5 +1,6 @@ import type { BaseContext } from "koa"; -import type { FlatTemplatable } from "tempstream"; +import { button } from "src/back/elements/button.js"; +import { tempstream, type FlatTemplatable } from "tempstream"; export async function default_navbar(ctx: BaseContext): Promise { const { items: navbar_items } = await ctx.$app.collections["navbar-links"] @@ -11,14 +12,19 @@ export async function default_navbar(ctx: BaseContext): Promise })); const linksHTML = linkData - .map((link) => - link.url === new URL(ctx.url, "https://a.com").pathname // checking if it's the current path we're looking at - ? `
  • ${link.text}
  • ` - : /* HTML */ `
  • ${link.text}
  • ` + .map( + (link) => /* HTML */ tempstream`
  • + ${button({ + text: link.text || "", + href: link.url || "", + variant: "accent1", + disabled: link.url == new URL(ctx.url, "https://a.com").pathname, // checking if it's the current path we're looking at + })} +
  • ` ) .join("\n"); - return /* HTML */ `