58 lines
2.0 KiB
Swift
58 lines
2.0 KiB
Swift
|
|
import SwiftUI
|
||
|
|
|
||
|
|
struct PrimaryActionStyle: ButtonStyle {
|
||
|
|
func makeBody(configuration: Configuration) -> some View {
|
||
|
|
configuration.label
|
||
|
|
.font(.headline)
|
||
|
|
.frame(maxWidth: .infinity)
|
||
|
|
.padding(.horizontal, 12)
|
||
|
|
.padding(.vertical, 12)
|
||
|
|
.background(
|
||
|
|
RoundedRectangle(cornerRadius: IdP.controlRadius, style: .continuous)
|
||
|
|
.fill(IdP.tint)
|
||
|
|
)
|
||
|
|
.foregroundStyle(.white)
|
||
|
|
.opacity(configuration.isPressed ? 0.92 : 1)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
struct SecondaryActionStyle: ButtonStyle {
|
||
|
|
func makeBody(configuration: Configuration) -> some View {
|
||
|
|
configuration.label
|
||
|
|
.font(.headline)
|
||
|
|
.frame(maxWidth: .infinity)
|
||
|
|
.padding(.horizontal, 12)
|
||
|
|
.padding(.vertical, 12)
|
||
|
|
.background(
|
||
|
|
RoundedRectangle(cornerRadius: IdP.controlRadius, style: .continuous)
|
||
|
|
.fill(Color.idpSecondaryGroupedBackground)
|
||
|
|
)
|
||
|
|
.overlay(
|
||
|
|
RoundedRectangle(cornerRadius: IdP.controlRadius, style: .continuous)
|
||
|
|
.stroke(Color.idpSeparator, lineWidth: 1)
|
||
|
|
)
|
||
|
|
.foregroundStyle(.white)
|
||
|
|
.opacity(configuration.isPressed ? 0.92 : 1)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
struct DestructiveStyle: ButtonStyle {
|
||
|
|
func makeBody(configuration: Configuration) -> some View {
|
||
|
|
configuration.label
|
||
|
|
.font(.headline)
|
||
|
|
.frame(maxWidth: .infinity)
|
||
|
|
.padding(.horizontal, 12)
|
||
|
|
.padding(.vertical, 12)
|
||
|
|
.background(
|
||
|
|
RoundedRectangle(cornerRadius: IdP.controlRadius, style: .continuous)
|
||
|
|
.fill(Color.red.opacity(0.18))
|
||
|
|
)
|
||
|
|
.overlay(
|
||
|
|
RoundedRectangle(cornerRadius: IdP.controlRadius, style: .continuous)
|
||
|
|
.stroke(Color.red.opacity(0.25), lineWidth: 1)
|
||
|
|
)
|
||
|
|
.foregroundStyle(.red)
|
||
|
|
.opacity(configuration.isPressed ? 0.92 : 1)
|
||
|
|
}
|
||
|
|
}
|