mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 01:50:20 +08:00
61 lines
1.6 KiB
Swift
61 lines
1.6 KiB
Swift
import SwiftUI
|
|
import BuddyUI
|
|
|
|
struct SettingsFooter: View {
|
|
var summaryText: () -> Text
|
|
var helpText: (() -> Text)? = nil
|
|
|
|
@State private var helpExpanded = false
|
|
|
|
var body: some View {
|
|
VStack(alignment: .listRowSeparatorLeading, spacing: 8) {
|
|
HStack(spacing: 0) {
|
|
summaryText()
|
|
|
|
Spacer()
|
|
|
|
if helpText != nil {
|
|
Group {
|
|
if #available(macOS 14.0, *) {
|
|
HelpLink {
|
|
helpExpanded.toggle()
|
|
}
|
|
} else {
|
|
Button {
|
|
helpExpanded.toggle()
|
|
} label: {
|
|
Image(systemName: "questionmark.circle")
|
|
}
|
|
.controlSize(.small)
|
|
.buttonStyle(.borderless)
|
|
}
|
|
}
|
|
.controlSize(.small)
|
|
}
|
|
}
|
|
|
|
if let helpText, helpExpanded {
|
|
helpText()
|
|
}
|
|
}
|
|
.settingsFooterStyle()
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
@ViewBuilder
|
|
func settingsFooterStyle() -> some View {
|
|
let padding: Double = if #available(macOS 26, *) {
|
|
0
|
|
} else {
|
|
8
|
|
}
|
|
frame(maxWidth: .infinity, alignment: .leading)
|
|
.foregroundStyle(.secondary)
|
|
.font(.footnote)
|
|
.multilineTextAlignment(.leading)
|
|
.padding(.leading, padding)
|
|
.textSelection(.enabled)
|
|
}
|
|
}
|