BusinessCard/BusinessCardClip/Views/Components/ClipPrimaryButton.swift

33 lines
994 B
Swift

import SwiftUI
import Bedrock
/// Primary CTA button used across App Clip views.
struct ClipPrimaryButton: View {
let title: String
let systemImage: String?
let action: () -> Void
init(title: String, systemImage: String? = nil, action: @escaping () -> Void) {
self.title = title
self.systemImage = systemImage
self.action = action
}
var body: some View {
Button(action: action) {
HStack(spacing: ClipDesign.Spacing.small) {
if let systemImage {
Image(systemName: systemImage)
.foregroundStyle(Color.Clip.background)
}
Text(title)
.styled(.headingEmphasis, emphasis: .custom(Color.Clip.background))
}
.frame(maxWidth: .infinity)
.frame(height: ClipDesign.Size.buttonHeight)
.background(Color.Clip.accent)
.clipShape(.capsule)
}
}
}