Create BearWave macOS radio-first app
This commit is contained in:
32
Sources/BearWaveCore/Views/NewGroupView.swift
Normal file
32
Sources/BearWaveCore/Views/NewGroupView.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
import SwiftUI
|
||||
|
||||
struct NewGroupView: View {
|
||||
@Environment(AppModel.self) private var model
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var name = ""
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
Text("Create new folder")
|
||||
.font(.title2.bold())
|
||||
|
||||
TextField("Folder name", text: $name)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Cancel") {
|
||||
dismiss()
|
||||
}
|
||||
Button("Create") {
|
||||
model.library.createGroup(name: name)
|
||||
dismiss()
|
||||
}
|
||||
.keyboardShortcut(.defaultAction)
|
||||
.disabled(name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||
}
|
||||
}
|
||||
.padding(24)
|
||||
.frame(width: 340)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user