WIP: Sidebar improvements, working on other views.

This commit is contained in:
2026-01-01 08:47:23 -05:00
parent 24c87602e9
commit 582d94d13b
10 changed files with 175 additions and 76 deletions

View File

@@ -0,0 +1,31 @@
import Elementary
import Foundation
public struct Number: HTML, Sendable {
let fractionDigits: Int
let value: Double
private var formatter: NumberFormatter {
let formatter = NumberFormatter()
formatter.maximumFractionDigits = fractionDigits
return formatter
}
public init(
_ value: Double,
digits fractionDigits: Int = 2
) {
self.value = value
self.fractionDigits = fractionDigits
}
public init(
_ value: Int
) {
self.init(Double(value), digits: 0)
}
public var body: some HTML<HTMLTag.span> {
span { formatter.string(for: value) ?? "N/A" }
}
}