blob: a899f36cf8d9b3ea2dfae15d83175b4ddee49950 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import SwiftUI
struct NewFolderSheet: View {
@Environment(\.dismiss) private var dismiss
let action: ((String) -> Void)?
@State private var folderName: String = "Untitled"
var body: some View {
Form {
TextField(text: self.$folderName) {
Text("Folder Name")
}
}
.formStyle(.grouped)
.fixedSize(horizontal: false, vertical: true)
.toolbar {
ToolbarItem(placement: .confirmationAction) {
Button("New Folder") {
self.dismiss()
self.action?(self.folderName)
}
}
ToolbarItem(placement: .cancellationAction) {
Button("Cancel") {
self.dismiss()
}
}
}
}
}
|