feat: Style updates, renames some files.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import Elementary
|
||||
|
||||
extension HTMLAttribute where Tag == HTMLTag.input {
|
||||
|
||||
static func min(_ value: String) -> Self {
|
||||
.init(name: "min", value: value)
|
||||
}
|
||||
|
||||
static func step(_ value: String) -> Self {
|
||||
.init(name: "step", value: value)
|
||||
}
|
||||
|
||||
}
|
||||
9
Sources/ViewControllerLive/Extensions/Href+route.swift
Normal file
9
Sources/ViewControllerLive/Extensions/Href+route.swift
Normal file
@@ -0,0 +1,9 @@
|
||||
import Elementary
|
||||
import Routes
|
||||
import URLRouting
|
||||
|
||||
extension HTMLAttribute where Tag: HTMLTrait.Attributes.href {
|
||||
static func href(route: SiteRoute.View) -> Self {
|
||||
.href(SiteRoute.View.router.path(for: route))
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,7 @@ struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
|
||||
main(.class("bg-white dark:bg-gray-800")) {
|
||||
div(.class("min-h-screen")) {
|
||||
Header()
|
||||
// div(.class("container")) {
|
||||
inner()
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,15 +42,32 @@ struct MainPage<Inner: HTML>: SendableHTMLDocument where Inner: Sendable {
|
||||
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"))
|
||||
header(.class("bg-blue-500 mb-8 flex flex-row gap-2 border-b border-yellow-300")) {
|
||||
a(
|
||||
.href(route: .index),
|
||||
.class("flex flex-row gap-2 bg-yellow-300 pe-2 rounded-e-lg text-blue-500 [&:hover]:text-blue-600")
|
||||
) {
|
||||
img(.src("/images/toolbox.svg"), .width(40), .height(40), .class("py-1"))
|
||||
div(.class("flex flex-row mt-2")) {
|
||||
h2(.class("text-2xl font-extrabold")) { "HVAC-Toolbox" }
|
||||
SVG.wind
|
||||
}
|
||||
}
|
||||
nav(.class("flex flex-row gap-2 p-2 mt-2")) {
|
||||
// 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-300 font-bold")) {
|
||||
li {
|
||||
a(.href(route: .moldRisk(.index)), .class("[&:hover]:border-b border-yellow-300")) {
|
||||
"Mold-Risk"
|
||||
}
|
||||
}
|
||||
li {
|
||||
a(.href("#"), .class("[&:hover]:border-b border-yellow-300")) {
|
||||
"Dehumidifier-Sizing"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,22 +18,21 @@ struct MoldRiskForm: HTML {
|
||||
"Indoor Temperature"
|
||||
}
|
||||
input(
|
||||
.type(.number), .id("temperature"), .placeholder("Dry bulb temperature"),
|
||||
.init(name: "step", value: "0.1"),
|
||||
.type(.number), .id("temperature"), .placeholder("Dry bulb temperature"), .required,
|
||||
.step("0.1"), .min("0.1"),
|
||||
.class("""
|
||||
w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-yellow-800
|
||||
focus:border-yellow-800 text-gray-700 dark:text-white
|
||||
""")
|
||||
)
|
||||
}
|
||||
|
||||
div {
|
||||
label(.for("humidity"), .class("block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2")) {
|
||||
"Indoor Humidity (%)"
|
||||
}
|
||||
input(
|
||||
.type(.number), .id("humidity"), .placeholder("Relative humidity"),
|
||||
.init(name: "step", value: "0.1"),
|
||||
.type(.number), .id("humidity"), .name("humidity"), .placeholder("Relative humidity"), .required,
|
||||
.step("0.1"), .min("0.1"),
|
||||
.class("""
|
||||
w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-yellow-800
|
||||
focus:border-yellow-800 text-gray-700 dark:text-white
|
||||
|
||||
@@ -4,7 +4,7 @@ enum SVG {
|
||||
static let wind = 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">
|
||||
class="w-8 h-8">
|
||||
<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>
|
||||
@@ -34,4 +34,13 @@ enum SVG {
|
||||
<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"></path>
|
||||
</svg>
|
||||
""")
|
||||
|
||||
static let menu = HTMLRaw("""
|
||||
<svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor"
|
||||
viewBox="0 0 24 24" x="0" y="0" id="menu-icon">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
|
||||
</svg>
|
||||
|
||||
""")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user