mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
move create label submit button into navbar
This commit is contained in:
parent
d68c8e5e33
commit
6c96b256d1
1 changed files with 14 additions and 18 deletions
|
|
@ -92,6 +92,10 @@ struct CreateLabelView: View {
|
|||
@State private var newLabelName = ""
|
||||
@State private var newLabelColor = Color.clear
|
||||
|
||||
var shouldDisableCreateButton: Bool {
|
||||
viewModel.isLoading || newLabelName.isEmpty || newLabelColor == .clear
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
VStack(spacing: 16) {
|
||||
|
|
@ -104,32 +108,24 @@ struct CreateLabelView: View {
|
|||
newLabelColor == .clear ? "Select Color" : newLabelColor.description,
|
||||
selection: $newLabelColor
|
||||
)
|
||||
Button(
|
||||
action: {
|
||||
viewModel.createLabel(
|
||||
dataService: dataService,
|
||||
name: newLabelName,
|
||||
color: newLabelColor,
|
||||
description: nil
|
||||
)
|
||||
},
|
||||
label: { Text("Create") }
|
||||
)
|
||||
.buttonStyle(SolidCapsuleButtonStyle(color: .appDeepBackground, width: 300))
|
||||
.disabled(viewModel.isLoading || newLabelName.isEmpty || newLabelColor == .clear)
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .automatic) {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
Button(
|
||||
action: { viewModel.showCreateEmailModal = false },
|
||||
label: {
|
||||
Image(systemName: "xmark")
|
||||
.foregroundColor(.appGrayTextContrast)
|
||||
}
|
||||
label: { Text("Cancel").foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
}
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button(
|
||||
action: {},
|
||||
label: { Text("Create").foregroundColor(.appGrayTextContrast) }
|
||||
)
|
||||
.opacity(shouldDisableCreateButton ? 0.2 : 1)
|
||||
.disabled(shouldDisableCreateButton)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Create New Label")
|
||||
#if os(iOS)
|
||||
|
|
|
|||
Loading…
Reference in a new issue