feat: Begins htmx integration

This commit is contained in:
2025-02-27 12:38:08 -05:00
parent 36e00cd007
commit 3e17bf2a9a
10 changed files with 227 additions and 49 deletions

View File

@@ -28,6 +28,7 @@ struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
.init(name: "sizes", value: "180x180")
)
link(.rel(.init(rawValue: "mainifest")), .href("/site.webmanifest"))
script(.src("https://unpkg.com/htmx.org@2.0.4")) {}
}
var body: some HTML {
@@ -59,7 +60,10 @@ private struct Header: HTML {
// TODO: Add class active, to button that is the active route.
ul(.class("flex flex-wrap gap-x-2 lg:gap-x-5 \(text: .yellow) font-bold")) {
li {
a(.href(route: .moldRisk(.index)), .class("hover:border-b \(border: .yellow)")) {
a(
.class("hover:border-b \(border: .yellow)"),
.hx.get(route: .moldRisk(.index)), .hx.target("#content"), .hx.pushURL(true)
) {
"Mold-Risk"
}
}
@@ -80,7 +84,9 @@ private struct PageContent<Body: HTML>: HTML where Body: Sendable {
var content: some HTML {
div(.class("mx-5 lg:mx-20")) {
div(.class("rounded-xl shadow-lg bg-white dark:bg-slate-700 p-8")) {
body()
div(.id("content")) {
body()
}
}
}
}