Customize action buttons to use letro gradient
This commit is contained in:
@@ -138,7 +138,7 @@ public struct CompoundButtonStyle: ButtonStyle {
|
||||
Capsule().strokeBorder(strokeColor(configuration: configuration))
|
||||
}
|
||||
case .primary:
|
||||
Capsule().fill(fillColor(configuration: configuration))
|
||||
makePrimaryBackground(configuration: configuration)
|
||||
case .secondary:
|
||||
Capsule().strokeBorder(strokeColor(configuration: configuration))
|
||||
case .tertiary:
|
||||
@@ -148,6 +148,20 @@ public struct CompoundButtonStyle: ButtonStyle {
|
||||
}
|
||||
}
|
||||
|
||||
// Letro: custom action buttons
|
||||
@ViewBuilder
|
||||
private func makePrimaryBackground(configuration: Self.Configuration) -> some View {
|
||||
if !isEnabled || configuration.role == .destructive {
|
||||
Capsule().fill(fillColor(configuration: configuration))
|
||||
} else {
|
||||
Capsule()
|
||||
.fill(LinearGradient(gradient: .compound.action,
|
||||
startPoint: .bottomLeading,
|
||||
endPoint: .topTrailing))
|
||||
.opacity(configuration.isPressed ? pressedOpacity : 1)
|
||||
}
|
||||
}
|
||||
|
||||
private var contentShape: AnyShape {
|
||||
switch kind {
|
||||
case .super, .primary, .secondary, .tertiary:
|
||||
|
||||
Reference in New Issue
Block a user