42 lines
1.5 KiB
Swift
42 lines
1.5 KiB
Swift
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
import SwiftUI
|
|
|
|
struct SecondaryCard<Content: View>: View {
|
|
private let content: Content
|
|
init(@ViewBuilder content: () -> Content) { self.content = content() }
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 12) { content }
|
|
.frame(maxWidth: .infinity, alignment: .leading).padding(14)
|
|
.background(Color.primary.opacity(0.035), in: RoundedRectangle(cornerRadius: 10))
|
|
.overlay(RoundedRectangle(cornerRadius: 10).strokeBorder(.primary.opacity(0.07)))
|
|
}
|
|
}
|
|
|
|
struct SecondaryHelp<Content: View>: View {
|
|
let title: String
|
|
private let content: Content
|
|
@State private var expanded = false
|
|
init(title: String, @ViewBuilder content: () -> Content) {
|
|
self.title = title; self.content = content()
|
|
}
|
|
var body: some View {
|
|
DisclosureGroup(isExpanded: $expanded) {
|
|
VStack(alignment: .leading, spacing: 8) { content }
|
|
.font(.callout).foregroundStyle(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true).padding(.top, 6)
|
|
} label: {
|
|
Label(title, systemImage: "questionmark.circle").font(.callout)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SecondaryAction: View {
|
|
let title: String
|
|
let systemImage: String
|
|
let action: () -> Void
|
|
var body: some View {
|
|
Button(action: action) { Label(title, systemImage: systemImage).foregroundStyle(.primary) }
|
|
.buttonStyle(.bordered)
|
|
}
|
|
}
|