Move settings + generation to sheets
This commit is contained in:
@ -0,0 +1,16 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LocalizedNavigationBarSettingsView: View {
|
||||
|
||||
@ObservedObject
|
||||
var settings: LocalizedNavigationSettings
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
StringPropertyView(
|
||||
title: "Root URL",
|
||||
text: $settings.rootUrl,
|
||||
footer: "The url leading to the root page for the language")
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
import SwiftUI
|
||||
import SFSafeSymbols
|
||||
|
||||
struct NavigationBarSettingsView: View {
|
||||
|
||||
@Environment(\.language)
|
||||
private var language
|
||||
|
||||
@EnvironmentObject
|
||||
private var content: Content
|
||||
|
||||
@State
|
||||
private var showItemPicker = false
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text("Links")
|
||||
.font(.headline)
|
||||
Button(action: { showItemPicker = true }) {
|
||||
Image(systemSymbol: .squareAndPencilCircleFill)
|
||||
.resizable()
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.frame(height: 22)
|
||||
.foregroundColor(Color.gray)
|
||||
.background(Circle()
|
||||
.fill(Color.white)
|
||||
.padding(1))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
ForEach(content.settings.navigation.navigationItems) { tag in
|
||||
TagView(text: tag.title(in: language))
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
Text("Select the tags to show in the navigation bar. The number should be even.")
|
||||
.foregroundStyle(.secondary)
|
||||
. padding(.bottom)
|
||||
|
||||
LocalizedNavigationBarSettingsView(settings: content.settings.navigation.localized(in: language))
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.sheet(isPresented: $showItemPicker) {
|
||||
ItemSelectionView(
|
||||
isPresented: $showItemPicker,
|
||||
selectedItems: $content.settings.navigation.navigationItems)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationBarSettingsView()
|
||||
.environmentObject(Content.mock)
|
||||
.padding()
|
||||
}
|
Reference in New Issue
Block a user