mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-29 11:41:01 +00:00
Post editor: Replace visibility menu with a bottom sheet to close #58
This commit is contained in:
parent
77ad9afb85
commit
54ac3d5adb
1 changed files with 22 additions and 10 deletions
|
@ -5,10 +5,12 @@ import Models
|
|||
import Env
|
||||
|
||||
struct StatusEditorAccessoryView: View {
|
||||
@EnvironmentObject private var theme: Theme
|
||||
@EnvironmentObject private var currentInstance: CurrentInstance
|
||||
|
||||
@FocusState<Bool>.Binding var isSpoilerTextFocused: Bool
|
||||
@ObservedObject var viewModel: StatusEditorViewModel
|
||||
@State private var isPrivacySheetDisplayed: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
@ -61,18 +63,28 @@ struct StatusEditorAccessoryView: View {
|
|||
}
|
||||
|
||||
private var visibilityMenu: some View {
|
||||
Menu {
|
||||
Button {
|
||||
isPrivacySheetDisplayed = true
|
||||
} label: {
|
||||
Image(systemName: viewModel.visibility.iconName)
|
||||
}
|
||||
.sheet(isPresented: $isPrivacySheetDisplayed) {
|
||||
Form {
|
||||
Section("Post visibility") {
|
||||
ForEach(Models.Visibility.allCases, id: \.self) { visibility in
|
||||
Button {
|
||||
viewModel.visibility = visibility
|
||||
isPrivacySheetDisplayed = false
|
||||
} label: {
|
||||
Label(visibility.title, systemImage: visibility.iconName)
|
||||
}
|
||||
}
|
||||
.listRowBackground(theme.primaryBackgroundColor)
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: viewModel.visibility.iconName)
|
||||
}
|
||||
.presentationDetents([.height(300)])
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(theme.secondaryBackgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue