69 lines
2.0 KiB
Swift
69 lines
2.0 KiB
Swift
import Elementary
|
|
|
|
struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
|
|
let title = "HVAC-Toolbox"
|
|
let lang = "en-US"
|
|
let inner: @Sendable () -> Inner
|
|
|
|
var head: some HTML {
|
|
meta(.charset(.utf8))
|
|
meta(.name("viewport"), .content("width=device-width, initial-scale=1.0"))
|
|
link(.rel(.stylesheet), .href("/output.css"))
|
|
link(
|
|
.rel(.icon),
|
|
.href("/favicon-32x32.png"),
|
|
.init(name: "type", value: "image/png"),
|
|
.init(name: "sizes", value: "32x32")
|
|
)
|
|
link(
|
|
.rel(.icon),
|
|
.href("/favicon-16x16.png"),
|
|
.init(name: "type", value: "image/png"),
|
|
.init(name: "sizes", value: "16x16")
|
|
)
|
|
link(
|
|
.rel(.init(rawValue: "apple-touch-icon")),
|
|
.href("/apple-touch-icon.png"),
|
|
.init(name: "sizes", value: "180x180")
|
|
)
|
|
link(.rel(.init(rawValue: "mainifest")), .href("/site.webmanifest"))
|
|
}
|
|
|
|
var body: some HTML {
|
|
main(.class("bg-white dark:bg-gray-800")) {
|
|
div(.class("min-h-screen")) {
|
|
Header()
|
|
div(.class("container")) {
|
|
inner()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct Header: HTML {
|
|
|
|
var content: some HTML {
|
|
header(.class("bg-blue-500")) {
|
|
a(.href("/")) {
|
|
div(.class("flex flex-row gap-2 p-2 mb-8")) {
|
|
img(.src("/favicon-32x32.png"))
|
|
h2(.class("text-2xl text-white font-extrabold")) { "HVAC-Toolbox" }
|
|
// img(.class("text-yellow-300"), .src("/images/wind.svg"))
|
|
HTMLRaw("""
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
class="w-8 h-8 text-yellow-300">
|
|
<path d="M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2"></path>
|
|
<path d="M9.6 4.6A2 2 0 1 1 11 8H2"></path>
|
|
<path d="M12.6 19.4A2 2 0 1 0 14 16H2"></path>
|
|
</svg>
|
|
""")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protocol SendableHTMLDocument: HTMLDocument, Sendable {}
|