Merge pull request #2241 from alexcfaber/feature/fix-add-folder

OPT: Cleanup Add Folder view on Mac, change SceneNavigationView to su…
This commit is contained in:
Maurice Parker 2020-07-09 14:11:49 -05:00 committed by GitHub
commit 94f956b41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 12 deletions

View File

@ -71,22 +71,28 @@ struct AddFolderView: View {
Form { Form {
HStack { HStack {
Spacer() Spacer()
Image("FaviconTemplateImage") Image(rsImage: AppAssets.faviconTemplateImage)
.resizable() .resizable()
.renderingMode(.template) .renderingMode(.template)
.frame(width: 30, height: 30) .frame(width: 30, height: 30)
.foregroundColor(.accentColor).font(.title)
Text("Add a Folder") Text("Add a Folder")
.font(.title) .font(.title)
Spacer() Spacer()
} }
TextField("Name", text: $viewModel.folderName)
.textFieldStyle(RoundedBorderTextFieldStyle()) LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
.help("The name of the folder you want to create") Text("Name:").bold()
accountPicker TextField("Name", text: $viewModel.folderName)
.help("Pick the account you want to create a folder in.") .textFieldStyle(RoundedBorderTextFieldStyle())
.help("The name of the folder you want to create")
Text("Account:").bold()
accountPicker
.help("Pick the account you want to create a folder in.")
})
buttonStack buttonStack
} }
.frame(maxWidth: 485)
.padding(12)
} }
#endif #endif

View File

@ -11,7 +11,8 @@ import SwiftUI
struct SceneNavigationView: View { struct SceneNavigationView: View {
@StateObject private var sceneModel = SceneModel() @StateObject private var sceneModel = SceneModel()
@State private var showSheet = false @State private var showSheet: Bool = false
@State private var sheetToShow: ToolbarSheets = .none
#if os(iOS) #if os(iOS)
@Environment(\.horizontalSizeClass) private var horizontalSizeClass @Environment(\.horizontalSizeClass) private var horizontalSizeClass
@ -49,18 +50,27 @@ struct SceneNavigationView: View {
.onAppear { .onAppear {
sceneModel.startup() sceneModel.startup()
} }
.sheet(isPresented: $showSheet, onDismiss: { showSheet = false }) { .sheet(isPresented: $showSheet, onDismiss: { sheetToShow = .none }) {
AddWebFeedView()
if sheetToShow == .web {
AddWebFeedView()
}
if sheetToShow == .folder {
AddFolderView()
}
}
.onChange(of: sheetToShow) { value in
value != .none ? (showSheet = true) : (showSheet = false)
} }
.toolbar { .toolbar {
#if os(macOS) #if os(macOS)
ToolbarItem() { ToolbarItem() {
Menu { Menu {
Button("Add Web Feed", action: { showSheet = true }) Button("Add Web Feed", action: { sheetToShow = .web })
Button("Add Reddit Feed", action: { }) Button("Add Reddit Feed", action: { })
Button("Add Twitter Feed", action: { }) Button("Add Twitter Feed", action: { })
Button("Add Folder", action: { }) Button("Add Folder", action: { sheetToShow = .folder})
} label : { } label : {
AppAssets.addMenuImage AppAssets.addMenuImage
} }