import SwiftUI private enum ButtonSizes { static let padding = 16.0 static let cornerRadius = 4.0 static let scaleEffect: CGFloat = 0.9 static let opacity: Double = 0.6 } struct PrimaryButtonStyle: ButtonStyle { @Environment(\.isEnabled) private var isEnabled func makeBody(configuration: Configuration) -> some View { configuration .label .font(.head2) .padding(ButtonSizes.padding) .frame(maxWidth: .infinity) .foregroundColor(.Material.Shape.white) .background { RoundedRectangle(cornerRadius: ButtonSizes.cornerRadius) .foregroundColor(isEnabled ? .Material.Elements.active : .Material.Shape.separator) } .contentShape(Rectangle()) .scaleEffect(configuration.isPressed ? ButtonSizes.scaleEffect : 1.0) .opacity(configuration.isPressed ? ButtonSizes.opacity : 1.0) .animation(.easeInOut(duration: 0.1), value: configuration.isPressed) } } struct SecondaryButtonStyle: ButtonStyle { @Environment(\.isEnabled) private var isEnabled func makeBody(configuration: Configuration) -> some View { configuration .label .font(.head2) .padding(ButtonSizes.padding) .frame(maxWidth: .infinity) .foregroundColor(isEnabled ? .Material.Elements.active : .Material.Shape.separator) .background { RoundedRectangle(cornerRadius: ButtonSizes.cornerRadius) .stroke(isEnabled ? Color.Material.Elements.active : Color.Material.Shape.separator) } .contentShape(Rectangle()) .scaleEffect(configuration.isPressed ? ButtonSizes.scaleEffect : 1.0) .opacity(configuration.isPressed ? ButtonSizes.opacity : 1.0) .animation(.easeInOut(duration: 0.1), value: configuration.isPressed) } }