Footer menu
Deploy / deploy (push) Successful in 8s

This commit is contained in:
2026-08-29 13:45:19 +05:00
parent 0857d77a01
commit ca92b16965
3 changed files with 48 additions and 40 deletions
+4
View File
@@ -10,3 +10,7 @@ Hello **world**, list:
Edited OFFLINE Edited OFFLINE
Edited OFFLINE v3 Edited OFFLINE v3
| Col A | Col B | Col C | Col D | Col E | Col F | Col G |
|-------|-------|-------|-------|-------|-------|-------|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| long text here to force overflow ........ | x | x | x | x | x |
+25 -29
View File
@@ -1,7 +1,7 @@
import { useEffect, useState } from "preact/hooks"; import { useEffect, useState } from "preact/hooks";
import { createClient } from "@connectrpc/connect"; import { createClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-web"; import { createConnectTransport } from "@connectrpc/connect-web";
import { BookOpen, Gauge, Link as LinkIcon, Menu, Play } from "lucide-preact"; import { BookOpen, Gauge, Link as LinkIcon, Play } from "lucide-preact";
import type { Item, Link } from "./gen/homelab/v1/homelab_pb"; import type { Item, Link } from "./gen/homelab/v1/homelab_pb";
import { HomelabService } from "./gen/homelab/v1/homelab_pb"; import { HomelabService } from "./gen/homelab/v1/homelab_pb";
import { MonitorCard } from "./components/MonitorCard"; import { MonitorCard } from "./components/MonitorCard";
@@ -44,7 +44,6 @@ export function App() {
exec: [], exec: [],
}); });
const [category, setCategory] = useState<Category>("monitor"); const [category, setCategory] = useState<Category>("monitor");
const [drawerOpen, setDrawerOpen] = useState(false);
const [docs, setDocs] = useState(localDocs()); const [docs, setDocs] = useState(localDocs());
const [openDoc, setOpenDoc] = useState<string | null>(null); const [openDoc, setOpenDoc] = useState<string | null>(null);
@@ -71,20 +70,27 @@ export function App() {
const open = docs.find((d) => d.name === openDoc); const open = docs.find((d) => d.name === openDoc);
return ( return (
<div class="drawer min-h-screen"> <div class="min-h-screen flex flex-col">
<input id="nav-drawer" type="checkbox" class="drawer-toggle" checked={drawerOpen} onChange={() => setDrawerOpen((v) => !v)} /> {/* Top bar: title on mobile, tab bar on desktop */}
<div class="navbar bg-base-200 px-4 pt-[env(safe-area-inset-top)]">
<div class="drawer-content flex flex-col"> <span class="text-lg font-bold md:hidden">{cat.label}</span>
{/* Top bar */} <div class="hidden md:flex flex-1 justify-center gap-1">
<div class="navbar bg-base-200 px-2 pt-[env(safe-area-inset-top)]"> {CATEGORIES.map((c) => (
<label class="btn btn-square btn-ghost" onClick={() => setDrawerOpen(true)}> <button
<Menu size={22} /> class={`btn btn-ghost btn-sm ${c.id === category ? "btn-primary" : ""}`}
</label> onClick={() => {
<span class="text-lg font-bold mx-auto">{open && category === "docs" ? open.name.replace(/\.md$/, "") : cat.label}</span> setCategory(c.id);
<span class="w-11" /> setOpenDoc(null);
}}
>
<c.icon size={18} /> {c.label}
</button>
))}
</div>
<span class="hidden md:block mx-auto text-lg font-bold absolute left-1/2 -translate-x-1/2 pointer-events-none">Homelab</span>
</div> </div>
<div class="max-w-md w-full mx-auto px-4 pb-[env(safe-area-inset-bottom)]"> <div class="flex-1 w-full max-w-md mx-auto px-4 pb-20 md:pb-6 pt-[env(safe-area-inset-top)]">
{category === "links" && <LinkList links={content.links} />} {category === "links" && <LinkList links={content.links} />}
{category === "monitor" && ( {category === "monitor" && (
<div class="flex flex-col gap-3 mt-4"> <div class="flex flex-col gap-3 mt-4">
@@ -99,25 +105,15 @@ export function App() {
<DocsView docs={docs} onOpen={(d) => setOpenDoc(d.name)} /> <DocsView docs={docs} onOpen={(d) => setOpenDoc(d.name)} />
))} ))}
</div> </div>
</div>
{/* Sidebar */} {/* Mobile footer nav */}
<div class="drawer-side z-20"> <div class="btm-nav md:hidden bg-base-200 pb-[env(safe-area-inset-bottom)] z-10">
<label class="drawer-overlay" onClick={() => setDrawerOpen(false)} />
<nav class="bg-base-200 min-h-full w-56 p-3 pt-[calc(env(safe-area-inset-top)+1rem)] flex flex-col gap-1">
{CATEGORIES.map((c) => ( {CATEGORIES.map((c) => (
<button <button class={c.id === category ? "active text-primary" : ""} onClick={() => { setCategory(c.id); setOpenDoc(null); }}>
class={`btn btn-ghost justify-start ${c.id === category ? "btn-primary" : ""}`} <c.icon size={20} />
onClick={() => { <span class="text-[10px]">{c.label}</span>
setCategory(c.id);
setOpenDoc(null);
setDrawerOpen(false);
}}
>
<c.icon size={18} /> {c.label}
</button> </button>
))} ))}
</nav>
</div> </div>
</div> </div>
); );
+8
View File
@@ -2,3 +2,11 @@
@plugin "daisyui" { @plugin "daisyui" {
themes: dark --default; themes: dark --default;
} }
/* Markdown reader: tables scroll sideways instead of overflowing the card. */
.prose table {
display: block;
overflow-x: auto;
white-space: nowrap;
}