Skip to content

Commit

Permalink
Fix maxWidth in CompoundButtonStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Oct 31, 2023
1 parent 410c933 commit f091389
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/Compound/BaseStyles/CompoundButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,20 @@ public struct CompoundButtonStyle: ButtonStyle {
}
}

private var maxWidth: CGFloat? {
switch kind {
case .plain:
return nil
case .primary, .secondary:
return .infinity
}
}

public func makeBody(configuration: Self.Configuration) -> some View {
configuration.label
.padding(.horizontal, horizontalPadding)
.padding(.vertical, verticalPadding)
.frame(maxWidth: .infinity)
.frame(maxWidth: maxWidth)
.font(.compound.bodyLGSemibold)
.foregroundColor(textColor(configuration: configuration))
.multilineTextAlignment(.center)
Expand Down

0 comments on commit f091389

Please sign in to comment.