Ferrite-backup/Ferrite/Views/CommonViews/ListRowViews.swift
kingbri d1b34fe964 Settings: Add AboutView and style buttons
Add a ListRowButtonView which runs a function and include a label.
Use this to style magnet choice buttons.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:35 -04:00

75 lines
1.5 KiB
Swift

//
// ListRowViews.swift
// Ferrite
//
// Created by Brian Dashore on 7/26/22.
//
import SwiftUI
// These views were imported from Asobi
// View alias for a list row with an external link
struct ListRowLinkView: View {
let text: String
let link: String
var body: some View {
HStack {
Link(text, destination: URL(string: link)!)
.foregroundColor(.primary)
Spacer()
Image(systemName: "arrow.up.forward.app.fill")
.foregroundColor(.gray)
}
}
}
struct ListRowButtonView: View {
let text: String
let systemImage: String?
let action: () -> Void
init(_ text: String, systemImage: String? = nil, action: @escaping () -> Void) {
self.text = text
self.systemImage = systemImage
self.action = action
}
var body: some View {
HStack {
Button(text) {
action()
}
Spacer()
if let imageName = systemImage {
Image(systemName: imageName)
.foregroundColor(.gray)
}
}
}
}
struct ListRowTextView: View {
let leftText: String
var rightText: String?
var rightSymbol: String?
var body: some View {
HStack {
Text(leftText)
Spacer()
if let rightText = rightText {
Text(rightText)
} else {
Image(systemName: rightSymbol!)
.foregroundColor(.gray)
}
}
}
}