35 lines
806 B
Swift
35 lines
806 B
Swift
import SwiftUI
|
|
|
|
struct FilePropertyView: View {
|
|
|
|
let title: String
|
|
|
|
let description: String
|
|
|
|
@Binding
|
|
var selectedFile: FileResource?
|
|
|
|
@State
|
|
private var showFileSelectionSheet = false
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
Text(title)
|
|
.font(.headline)
|
|
HStack {
|
|
Text(selectedFile?.id ?? "No file selected")
|
|
Spacer()
|
|
Button("Select") {
|
|
showFileSelectionSheet = true
|
|
}
|
|
}
|
|
Text(description)
|
|
.foregroundStyle(.secondary)
|
|
.padding(.bottom)
|
|
}
|
|
.sheet(isPresented: $showFileSelectionSheet) {
|
|
FileSelectionView(selectedFile: $selectedFile)
|
|
}
|
|
}
|
|
}
|