This repository has been archived on 2026-02-12. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
swift-duct-calc/Sources/ViewController/Views/MainPage.swift

57 lines
1.2 KiB
Swift

import Elementary
import ElementaryHTMX
import ManualDCore
import Styleguide
public struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
public var title: String { "Manual-D" }
public var lang: String { "en" }
let inner: Inner
init(
_ inner: () -> Inner
) {
self.inner = inner()
}
public var head: some HTML {
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("/js/main.js")) {}
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 {
inner
}
script(.src("https://unpkg.com/lucide@latest")) {}
script {
"lucide.createIcons();"
}
}
}
struct LoggedIn: HTML, Sendable {
let next: String?
var body: some HTML {
div(
.hx.get(next ?? SiteRoute.View.router.path(for: .project(.index))),
.hx.pushURL(true),
.hx.target("body"),
.hx.trigger(.event(.revealed)),
.hx.indicator(".hx-indicator")
) {
Indicator()
}
}
}
public protocol SendableHTMLDocument: HTMLDocument, Sendable {}