feat: Adds hydronic system pressure calculator.
This commit is contained in:
@@ -59,6 +59,17 @@ public struct Input: HTML, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public extension Input {
|
||||
|
||||
init<Key>(
|
||||
id: Key,
|
||||
name: String? = nil,
|
||||
placeholder: String
|
||||
) where Key: RawRepresentable, Key.RawValue == String {
|
||||
self.init(id: id.rawValue, name: name, placeholder: placeholder)
|
||||
}
|
||||
}
|
||||
|
||||
/// A style form input label.
|
||||
public struct InputLabel<InputLabel: HTML>: HTML {
|
||||
|
||||
|
||||
17
Sources/Styleguide/ResultBox.swift
Normal file
17
Sources/Styleguide/ResultBox.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
import Elementary
|
||||
|
||||
public struct ResultBox<Body: HTML>: HTML {
|
||||
let body: Body
|
||||
|
||||
public init(@HTMLBuilder body: () -> Body) {
|
||||
self.body = body()
|
||||
}
|
||||
|
||||
public var content: some HTML<HTMLTag.div> {
|
||||
div(.class("w-full rounded-lg shadow-lg bg-blue-100 border border-blue-600 text-blue-600 p-6")) {
|
||||
body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension ResultBox: Sendable where Body: Sendable {}
|
||||
18
Sources/Styleguide/RoundedBox.swift
Normal file
18
Sources/Styleguide/RoundedBox.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
import Elementary
|
||||
|
||||
// A rounded box, with no color styles. Colors should be added at call site.
|
||||
public struct Box<Body: HTML>: HTML {
|
||||
let body: Body
|
||||
|
||||
public init(@HTMLBuilder body: () -> Body) {
|
||||
self.body = body()
|
||||
}
|
||||
|
||||
public var content: some HTML<HTMLTag.div> {
|
||||
div(.class("w-full rounded-lg shadow-lgp-6")) {
|
||||
body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension Box: Sendable where Body: Sendable {}
|
||||
@@ -45,6 +45,7 @@ public struct SVGSize: Sendable {
|
||||
public enum SVGType: Sendable, CaseIterable {
|
||||
case calculator
|
||||
case checkCircle
|
||||
case circleGauge
|
||||
case droplets
|
||||
case exclamation
|
||||
case funnel
|
||||
@@ -63,6 +64,7 @@ public enum SVGType: Sendable, CaseIterable {
|
||||
switch self {
|
||||
case .calculator: return calculatorSvg(size: size)
|
||||
case .checkCircle: return checkCircleSvg(size: size)
|
||||
case .circleGauge: return circleGaugeSvg(size: size)
|
||||
case .droplets: return dropletsSvg(size: size)
|
||||
case .exclamation: return exclamationSvg(size: size)
|
||||
case .funnel: return funnelSvg(size: size)
|
||||
@@ -84,6 +86,16 @@ public enum SVGType: Sendable, CaseIterable {
|
||||
|
||||
// swiftlint:disable line_length
|
||||
|
||||
private func circleGaugeSvg(size: SVGSize) -> HTMLRaw {
|
||||
HTMLRaw("""
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="\(size.width)" height="\(size.height)" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-gauge">
|
||||
<path d="M15.6 2.7a10 10 0 1 0 5.7 5.7"/>
|
||||
<circle cx="12" cy="12" r="2"/>
|
||||
<path d="M13.4 10.6 19 5"/>
|
||||
</svg>
|
||||
""")
|
||||
}
|
||||
|
||||
private func scaleSvg(size: SVGSize) -> HTMLRaw {
|
||||
HTMLRaw("""
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="\(size.width)" height="\(size.height)" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-scale">
|
||||
|
||||
Reference in New Issue
Block a user