- ManaThemeUI: geteiltes Karten-Chrome `.manaCard(...)` (continuous Squircle + optionaler Border aus EINER gemeinsamen Form, saubere Ecken) und `RoundedRectangle.mana(Radius.*)` als geteilte Ecken-Sprache. - ManaSignInCTA (Login) + ManaFeedbackCard ziehen auf `.manaCard` — identisches Chrome, Login bekommt denselben Border, beide continuous. - Rest-Chrome (Eingabefelder, Primary-Button, Feedback-Buttons, 2FA-QR/Codes/ Kopier-Buttons) auf `RoundedRectangle.mana(Radius.*)`; keine cornerRadius- Literale mehr, Radien auf Token-Skala konvergiert. - ManaAboutSection: vereinheitlichte „Über"-Sektion (App/Version/Build + Links), opt-in via `ManaAccountView(about:)`. Kein API-Bruch (alles additiv/optisch). CHANGELOG aktualisiert. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
61 lines
2 KiB
Swift
61 lines
2 KiB
Swift
import ManaThemeUI
|
|
import ManaTokens
|
|
import SwiftUI
|
|
|
|
/// Großer Primary-Button für Auth-Aktionen ("Anmelden", "Registrieren",
|
|
/// "Passwort setzen"). Brand-getöntes Background, dunkler Text,
|
|
/// integrierter ProgressView wenn `isLoading == true`.
|
|
public struct ManaPrimaryButton: View {
|
|
@Environment(\.manaBrand) private var brand
|
|
private let title: String
|
|
private let role: ButtonRole?
|
|
private let isLoading: Bool
|
|
private let isEnabled: Bool
|
|
private let action: () -> Void
|
|
|
|
/// - Parameters:
|
|
/// - title: Label des Buttons.
|
|
/// - role: Wenn `.destructive`, wird Brand-Error statt Brand-Primary
|
|
/// genutzt (z.B. für `ManaDeleteAccountView`). Default `nil`.
|
|
/// - isLoading: Zeigt ProgressView statt Text. Button bleibt disabled.
|
|
/// - isEnabled: Zusätzliches Disable-Flag (z.B. leere Felder).
|
|
/// - action: Callback bei Tap.
|
|
public init(
|
|
_ title: String,
|
|
role: ButtonRole? = nil,
|
|
isLoading: Bool = false,
|
|
isEnabled: Bool = true,
|
|
action: @escaping () -> Void
|
|
) {
|
|
self.title = title
|
|
self.role = role
|
|
self.isLoading = isLoading
|
|
self.isEnabled = isEnabled
|
|
self.action = action
|
|
}
|
|
|
|
public var body: some View {
|
|
Button(role: role, action: action) {
|
|
HStack(spacing: 8) {
|
|
if isLoading {
|
|
ProgressView()
|
|
.controlSize(.small)
|
|
.tint(brand.primaryForeground)
|
|
}
|
|
Text(title)
|
|
.fontWeight(.semibold)
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.padding(.vertical, 14)
|
|
.background(backgroundColor, in: RoundedRectangle.mana(Radius.md))
|
|
.foregroundStyle(brand.primaryForeground)
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(isLoading || !isEnabled)
|
|
.opacity((isLoading || !isEnabled) ? 0.6 : 1.0)
|
|
}
|
|
|
|
private var backgroundColor: Color {
|
|
role == .destructive ? brand.error : brand.primary
|
|
}
|
|
}
|