84 lines
2.6 KiB
Swift
84 lines
2.6 KiB
Swift
//
|
|
// ToolBar.swift
|
|
// Gemini-iOS
|
|
//
|
|
// Created by Shadowfacts on 9/28/20.
|
|
//
|
|
|
|
import SwiftUI
|
|
import BrowserCore
|
|
|
|
struct ToolBar: View {
|
|
@ObservedObject var navigator: NavigationManager
|
|
let shareCurrentURL: () -> Void
|
|
@State private var showPreferencesSheet = false
|
|
|
|
@Environment(\.colorScheme) var colorScheme: ColorScheme
|
|
|
|
var body: some View {
|
|
VStack(spacing: 4) {
|
|
Rectangle()
|
|
.frame(height: 1)
|
|
.foregroundColor(Color(white: colorScheme == .dark ? 0.25 : 0.75))
|
|
|
|
HStack {
|
|
// use a group because this exceeds the 10 view limit :/
|
|
Group {
|
|
Spacer()
|
|
|
|
Button(action: navigator.back) {
|
|
Image(systemName: "arrow.left")
|
|
.font(.system(size: 24))
|
|
}
|
|
.disabled(navigator.backStack.isEmpty)
|
|
|
|
Spacer()
|
|
|
|
Button(action: navigator.forward) {
|
|
Image(systemName: "arrow.right")
|
|
.font(.system(size: 24))
|
|
}
|
|
.disabled(navigator.forwardStack.isEmpty)
|
|
|
|
Spacer()
|
|
|
|
Button(action: navigator.reload) {
|
|
Image(systemName: "arrow.clockwise")
|
|
.font(.system(size: 24))
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button(action: shareCurrentURL) {
|
|
Image(systemName: "square.and.arrow.up")
|
|
.font(.system(size: 24))
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button(action: {
|
|
showPreferencesSheet = true
|
|
}, label: {
|
|
Image(systemName: "gear")
|
|
.font(.system(size: 24))
|
|
})
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
|
|
}
|
|
.padding(.bottom, 4)
|
|
.background(Color(UIColor.systemBackground).edgesIgnoringSafeArea(.bottom))
|
|
.sheet(isPresented: $showPreferencesSheet, content: {
|
|
PreferencesView(presented: $showPreferencesSheet)
|
|
})
|
|
}
|
|
}
|
|
|
|
struct ToolBar_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
ToolBar(navigator: NavigationManager(url: URL(string: "gemini://localhost/overview.gmi")!), shareCurrentURL: {})
|
|
}
|
|
}
|