WIP: Adds daisyui.

This commit is contained in:
2026-01-02 11:17:20 -05:00
parent 89fdf0930b
commit 4750842a57
13 changed files with 16206 additions and 38 deletions

View File

@@ -15,18 +15,17 @@ public struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable
meta(.charset(.utf8))
meta(.name(.viewport), .content("width=device-width, initial-scale=1.0"))
script(.src("https://unpkg.com/htmx.org@2.0.8")) {}
script(.src("https://cdn.tailwindcss.com")) {}
script(.src("/js/main.js")) {}
script(.src("https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4")) {}
link(.rel(.stylesheet), .href("/css/main.css"))
link(.rel(.stylesheet), .href("/css/output.css"))
link(.rel(.icon), .href("/images/favicon.ico"), .custom(name: "type", value: "image/x-icon"))
}
public var body: some HTML {
div(.class("bg-white dark:bg-gray-800 dark:text-white")) {
// div(.class("bg-white dark:bg-gray-800 dark:text-white")) {
div {
div(.class("flex flex-row")) {
Sidebar(active: activeTab)
main(.class("flex flex-col h-screen w-full")) {
main(.class("flex flex-col h-screen w-full px-6 py-10")) {
inner
}
}

View File

@@ -12,25 +12,19 @@ struct RoomsView: HTML, Sendable {
div(.class("m-10")) {
Row {
h1(.class("text-3xl font-bold pb-6")) { "Room Loads" }
// div(
// .class("tooltip"),
// .data("tip", value: "Add room")
// ) {
// PlusButton()
// .attributes(
// .hx.get(route: .room(.form(dismiss: false))),
// .hx.target("#roomForm"),
// .hx.swap(.outerHTML),
// .class("btn")
// )
// }
HTMLRaw(
"""
<div class="tooltip" data-tip="hello">
<button class="btn">Hover me</button>
</div>
"""
)
div(
.class("tooltip tooltip-left"),
.data("tip", value: "Add room")
) {
button(
.hx.get(route: .room(.form(dismiss: false))),
.hx.target("#roomForm"),
.hx.swap(.outerHTML),
.class("btn btn-primary w-[40px]")
) {
"+"
}
}
}
div(
@@ -98,17 +92,17 @@ struct RoomsView: HTML, Sendable {
Row {
div {}
Number(rooms.heatingTotal)
.attributes(.class("bg-red-500 text-white font-bold rounded-lg shadow-lg px-4 py-2"))
.attributes(.class("badge badge-outline badge-error badge-xl text-xl font-bold"))
}
Row {
div {}
Number(rooms.coolingTotal)
.attributes(.class("bg-green-400 text-white font-bold rounded-lg shadow-lg px-4 py-2"))
.attributes(.class("badge badge-outline badge-success badge-xl text-xl font-bold"))
}
Row {
div {}
Number(rooms.coolingSensibleTotal)
.attributes(.class("bg-blue-400 text-white font-bold rounded-lg shadow-lg px-4 py-2"))
.attributes(.class("badge badge-outline badge-info badge-xl text-xl font-bold"))
}
// Empty register count column
div {}

View File

@@ -17,6 +17,14 @@ struct Sidebar: HTML {
"""
)
) {
// TODO: Move somewhere outside of the sidebar.
Row {
Label("Theme")
input(.type(.checkbox), .class("toggle theme-controller"), .value("light"))
}
.attributes(.class("py-4"))
row(title: "Project", icon: .mapPin, route: .project(.index))
.attributes(.data("active", value: active == .projects ? "true" : "false"))