38 lines
884 B
Swift
38 lines
884 B
Swift
//
|
|
// ResourcesBarRow.swift
|
|
// iKeyMon
|
|
//
|
|
// Created by tracer on 31.03.25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct LoadBarCell: View {
|
|
let percent: Double
|
|
let load1: Double
|
|
let load5: Double
|
|
let load15: Double
|
|
var subtext: String? = nil
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
HStack {
|
|
Text(String(format: "%.2f%%", percent))
|
|
.foregroundColor(.green)
|
|
Text(String(format: "(%.2f / %.2f / %.2f)", load1, load5, load15))
|
|
}
|
|
if let subtext {
|
|
Text(subtext)
|
|
.font(.caption)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
ProgressView(value: percent / 100)
|
|
.progressViewStyle(.linear)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
LoadBarCell(percent: 2.34, load1: 1.23, load5: 0.08, load15: 0.06)
|
|
}
|