Restore branded button disabled states

This commit is contained in:
joshavant
2026-07-03 18:20:40 -05:00
committed by Josh Avant
parent ce4abc9b91
commit 37474b2e06
3 changed files with 25 additions and 12 deletions
+6 -6
View File
@@ -8275,7 +8275,7 @@
},
{
"kind": "ui-modifier",
"line": 649,
"line": 660,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "OpenClaw",
"surface": "apple",
@@ -8283,7 +8283,7 @@
},
{
"kind": "ui-modifier",
"line": 677,
"line": 688,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "Gateway \\(self.title)",
"surface": "apple",
@@ -8291,7 +8291,7 @@
},
{
"kind": "conditional-branch",
"line": 682,
"line": 693,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "Online",
"surface": "apple",
@@ -8299,7 +8299,7 @@
},
{
"kind": "conditional-branch",
"line": 684,
"line": 695,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "Connecting",
"surface": "apple",
@@ -8307,7 +8307,7 @@
},
{
"kind": "conditional-branch",
"line": 686,
"line": 697,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "Attention",
"surface": "apple",
@@ -8315,7 +8315,7 @@
},
{
"kind": "conditional-branch",
"line": 688,
"line": 699,
"path": "apps/ios/Sources/Design/OpenClawProComponents.swift",
"source": "Offline",
"surface": "apple",
@@ -563,37 +563,48 @@ struct OpenClawStatusBadge: View {
}
struct OpenClawPrimaryButtonStyle: ButtonStyle {
@Environment(\.isEnabled) private var isEnabled
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(OpenClawType.headline)
.foregroundStyle(.white)
.foregroundStyle(self.isEnabled ? Color.white : OpenClawBrand.textSecondary)
.frame(maxWidth: .infinity, minHeight: 48)
.background {
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
.fill(
configuration.isPressed
!self.isEnabled
? Color(uiColor: .tertiarySystemFill)
: configuration.isPressed
? OpenClawBrand.accentPressed
: OpenClawBrand.accent)
}
.animation(.easeOut(duration: 0.15), value: configuration.isPressed)
.animation(.easeOut(duration: 0.15), value: self.isEnabled)
}
}
struct OpenClawSecondaryButtonStyle: ButtonStyle {
@Environment(\.isEnabled) private var isEnabled
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(OpenClawType.headline)
.foregroundStyle(OpenClawBrand.textPrimary)
.foregroundStyle(self.isEnabled ? OpenClawBrand.textPrimary : OpenClawBrand.textSecondary.opacity(0.68))
.frame(maxWidth: .infinity, minHeight: 48)
.background {
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
.fill(Color(uiColor: .secondarySystemBackground))
.fill(Color(uiColor: self.isEnabled ? .secondarySystemBackground : .tertiarySystemFill))
.overlay {
RoundedRectangle(cornerRadius: OpenClawRadius.sm, style: .continuous)
.strokeBorder(Color(uiColor: .separator).opacity(0.35), lineWidth: 1)
.strokeBorder(
Color(uiColor: .separator).opacity(self.isEnabled ? 0.35 : 0.20),
lineWidth: 1)
}
}
.opacity(configuration.isPressed ? 0.82 : 1)
.opacity(!self.isEnabled ? 0.74 : configuration.isPressed ? 0.82 : 1)
.animation(.easeOut(duration: 0.15), value: configuration.isPressed)
.animation(.easeOut(duration: 0.15), value: self.isEnabled)
}
}
@@ -169,6 +169,8 @@ struct OpenClawTypographyTests {
#expect(proComponents.contains(".font(OpenClawType.subheadSemiBold)"))
#expect(proComponents.contains("Text(primaryActionTitle)"))
#expect(proComponents.contains("Text(secondaryActionTitle)"))
#expect(proComponents.contains("@Environment(\\.isEnabled)"))
#expect(proComponents.contains(".animation(.easeOut(duration: 0.15), value: self.isEnabled)"))
#expect(!quickSetup.contains("Button(\"Close\")"))
#expect(quickSetup.contains("Text(\"Quick Setup\")"))