yattee/Shared/Views/SettingsButtons.swift

28 lines
809 B
Swift
Raw Permalink Normal View History

2022-12-11 22:15:56 +00:00
import SwiftUI
struct SettingsButtons: View {
@ObservedObject private var accounts = AccountsModel.shared
private var navigation = NavigationModel.shared
var body: some View {
Button(action: { navigation.presentingAccounts = true }) {
2022-12-11 22:40:08 +00:00
if let account = accounts.current {
Label(account.description, image: account.app?.rawValue.capitalized ?? "")
} else {
Label("Signed Out", systemImage: "xmark")
}
2022-12-11 22:15:56 +00:00
}
Button(action: { navigation.presentingSettings = true }) {
Label("Settings", systemImage: "gearshape.2")
}
}
}
struct SettingsButtons_Previews: PreviewProvider {
static var previews: some View {
2022-12-11 22:40:08 +00:00
VStack(spacing: 10) {
SettingsButtons()
}
2022-12-11 22:15:56 +00:00
}
}