mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Adds Toolbar for Sidebar & SettingsViews for iOS
This commit is contained in:
@@ -12,6 +12,7 @@ struct CompactSidebarContainerView: View {
|
||||
|
||||
@EnvironmentObject private var sceneModel: SceneModel
|
||||
@StateObject private var sidebarModel = SidebarModel()
|
||||
@State private var showSettings: Bool = false
|
||||
|
||||
var body: some View {
|
||||
SidebarView()
|
||||
@@ -22,8 +23,42 @@ struct CompactSidebarContainerView: View {
|
||||
sceneModel.sidebarModel = sidebarModel
|
||||
sidebarModel.delegate = sceneModel
|
||||
sidebarModel.rebuildSidebarItems()
|
||||
}.overlay(Group {
|
||||
#if os(iOS)
|
||||
SidebarToolbar()
|
||||
#endif
|
||||
},alignment: .bottom)
|
||||
}
|
||||
|
||||
|
||||
var compactToolBar: some View {
|
||||
VStack {
|
||||
Divider()
|
||||
HStack(alignment: .center) {
|
||||
Button(action: {
|
||||
showSettings = true
|
||||
}, label: {
|
||||
Image(systemName: "gear")
|
||||
.font(.title3)
|
||||
.foregroundColor(.accentColor)
|
||||
}).help("Settings")
|
||||
Spacer()
|
||||
Text("Last updated")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
Button(action: {}, label: {
|
||||
Image(systemName: "plus")
|
||||
.font(.title3)
|
||||
.foregroundColor(.accentColor)
|
||||
}).help("Add")
|
||||
}
|
||||
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.bottom, 12)
|
||||
.padding(.top, 4)
|
||||
}
|
||||
.background(VisualEffectBlur(blurStyle: .systemChromeMaterial).edgesIgnoringSafeArea(.bottom))
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ struct RegularSidebarContainerView: View {
|
||||
@EnvironmentObject private var sceneModel: SceneModel
|
||||
@StateObject private var sidebarModel = SidebarModel()
|
||||
|
||||
var body: some View {
|
||||
@State private var showSettings: Bool = false
|
||||
|
||||
@ViewBuilder var body: some View {
|
||||
SidebarView()
|
||||
.environmentObject(sidebarModel)
|
||||
.navigationTitle(Text("Feeds"))
|
||||
@@ -23,7 +25,14 @@ struct RegularSidebarContainerView: View {
|
||||
sidebarModel.delegate = sceneModel
|
||||
sidebarModel.rebuildSidebarItems()
|
||||
}
|
||||
.overlay(Group {
|
||||
#if os(iOS)
|
||||
SidebarToolbar()
|
||||
#endif
|
||||
},alignment: .bottom)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct RegularSidebarContainerView_Previews: PreviewProvider {
|
||||
|
||||
53
Multiplatform/Shared/Sidebar/SidebarToolbar.swift
Normal file
53
Multiplatform/Shared/Sidebar/SidebarToolbar.swift
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// SidebarToolbar.swift
|
||||
// Multiplatform iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 30/6/20.
|
||||
// Copyright © 2020 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SidebarToolbar: View {
|
||||
|
||||
@State private var showSettings: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Divider()
|
||||
HStack(alignment: .center) {
|
||||
Button(action: {
|
||||
showSettings = true
|
||||
}, label: {
|
||||
Image(systemName: "gear")
|
||||
.font(.title3)
|
||||
.foregroundColor(.accentColor)
|
||||
}).help("Settings")
|
||||
Spacer()
|
||||
Text("Last updated")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
Button(action: {}, label: {
|
||||
Image(systemName: "plus")
|
||||
.font(.title3)
|
||||
.foregroundColor(.accentColor)
|
||||
}).help("Add")
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.bottom, 12)
|
||||
.padding(.top, 4)
|
||||
}
|
||||
.background(VisualEffectBlur(blurStyle: .systemChromeMaterial).edgesIgnoringSafeArea(.bottom))
|
||||
.sheet(isPresented: $showSettings, onDismiss: { showSettings = false }) {
|
||||
SettingsView()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct SidebarToolbar_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SidebarToolbar()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user