89 lines
3.0 KiB
Swift
89 lines
3.0 KiB
Swift
import SwiftUI
|
|
|
|
private struct IconDescriptionView: View {
|
|
|
|
@ObservedObject
|
|
var settings: LocalizedSettings
|
|
|
|
var body: some View {
|
|
TextField("", text: $settings.navigationBarIconDescription)
|
|
.textFieldStyle(.roundedBorder)
|
|
.frame(maxWidth: 300)
|
|
}
|
|
}
|
|
|
|
struct NavigationBarSettingsView: View {
|
|
|
|
@Environment(\.language)
|
|
private var language
|
|
|
|
@EnvironmentObject
|
|
private var content: Content
|
|
|
|
@State
|
|
private var showTagPicker = false
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
VStack(alignment: .leading) {
|
|
Text("Notification Bar Settings")
|
|
.font(.largeTitle)
|
|
.bold()
|
|
Text("Customize the navigation bar for all pages at the top of the website")
|
|
.foregroundStyle(.secondary)
|
|
.padding(.bottom, 30)
|
|
|
|
Text("Icon Path")
|
|
.font(.headline)
|
|
TextField("", text: $content.settings.navigationBar.iconPath)
|
|
.textFieldStyle(.roundedBorder)
|
|
.frame(maxWidth: 300)
|
|
Text("Specify the path to the icon file with regard to the final website folder.")
|
|
.foregroundStyle(.secondary)
|
|
.padding(.bottom, 30)
|
|
|
|
Text("Icon Description")
|
|
.font(.headline)
|
|
IconDescriptionView(settings: content.settings.localized(in: language))
|
|
Text("Provide a description of the icon for screen readers.")
|
|
.foregroundStyle(.secondary)
|
|
.padding(.bottom)
|
|
|
|
Text("Visible Tags")
|
|
.font(.headline)
|
|
FlowHStack {
|
|
ForEach(content.settings.navigationBar.tags, id: \.id) { tag in
|
|
TagView(text: tag.localized(in: language).name)
|
|
.foregroundStyle(.white)
|
|
}
|
|
Button(action: { showTagPicker = true }) {
|
|
Image(systemSymbol: .squareAndPencilCircleFill)
|
|
.resizable()
|
|
.aspectRatio(1, contentMode: .fit)
|
|
.frame(height: 22)
|
|
.foregroundColor(Color.gray)
|
|
.background(Circle()
|
|
.fill(Color.white)
|
|
.padding(1))
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
Text("Select the tags to show in the navigation bar. The number should be even.")
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
.sheet(isPresented: $showTagPicker) {
|
|
TagSelectionView(
|
|
presented: $showTagPicker,
|
|
selected: $content.settings.navigationBar.tags,
|
|
tags: $content.tags)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
NavigationBarSettingsView()
|
|
.environmentObject(Content.mock)
|
|
.padding()
|
|
}
|