Skip to content

Commit

Permalink
Update the stroke colour of the secondary button style to match Figma.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Oct 10, 2024
1 parent 94d93d0 commit 4485f3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions Sources/Compound/BaseStyles/CompoundButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ public struct CompoundButtonStyle: ButtonStyle {
.compositingGroup()
.opacity(configuration.isPressed ? pressedOpacity : 1)
} else {
Capsule().stroke(buttonColor(configuration: configuration))
Capsule().stroke(strokeColor(configuration: configuration))
}
case .primary:
Capsule().fill(buttonColor(configuration: configuration))
Capsule().fill(fillColor(configuration: configuration))
case .secondary:
Capsule().stroke(buttonColor(configuration: configuration))
Capsule().stroke(strokeColor(configuration: configuration))
case .plain:
EmptyView()
}
Expand All @@ -127,7 +127,7 @@ public struct CompoundButtonStyle: ButtonStyle {
}
}

private func buttonColor(configuration: Self.Configuration) -> Color {
private func fillColor(configuration: Self.Configuration) -> Color {
guard isEnabled else { return .compound.bgActionPrimaryDisabled }
if configuration.role == .destructive {
return .compound.bgCriticalPrimary.opacity(configuration.isPressed ? pressedOpacity : 1)
Expand All @@ -136,6 +136,14 @@ public struct CompoundButtonStyle: ButtonStyle {
}
}

private func strokeColor(configuration: Self.Configuration) -> Color {
if configuration.role == .destructive {
return .compound.borderCriticalPrimary.opacity(configuration.isPressed ? pressedOpacity : 1)
} else {
return .compound.borderInteractiveSecondary.opacity(configuration.isPressed ? pressedOpacity : 1)
}
}

private func textColor(configuration: Configuration) -> Color {
if kind == .primary {
return .compound.textOnSolidPrimary
Expand Down

0 comments on commit 4485f3c

Please sign in to comment.