Refactor project structure and API
This commit is contained in:
42
Views/Rows/InfoRow.swift
Normal file
42
Views/Rows/InfoRow.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// InfoView.swift
|
||||
// iKeyMon
|
||||
//
|
||||
// Created by tracer on 30.03.25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct InfoRow: View {
|
||||
var label: String
|
||||
var value: [String]
|
||||
var color: Color = .primary
|
||||
|
||||
init(label: String, value: String) {
|
||||
self.label = label
|
||||
self.value = [value]
|
||||
}
|
||||
|
||||
init(label: String, value: [String]) {
|
||||
self.label = label
|
||||
self.value = value
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top) {
|
||||
Text(label)
|
||||
.foregroundStyle(.secondary)
|
||||
.frame(width: 160, alignment: .leading)
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
ForEach(value, id: \.self) { item in
|
||||
Text(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 4)
|
||||
}
|
||||
}
|
||||
#Preview {
|
||||
InfoRow(label: "Hostname", value: "keyhelp.lab.24unix.net")
|
||||
}
|
||||
Reference in New Issue
Block a user