Skip to content

Commit dfde73b

Browse files
committed
Disable vote pill while submission is in flight
1 parent 5cf830c commit dfde73b

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

DesignSystem/Sources/DesignSystem/Components/PostDisplayView.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,25 @@ public struct PostDisplayView: View {
356356
Capsule()
357357
.fill(backgroundColor)
358358
)
359-
Button(action: action ?? {}) {
360-
content
359+
return Button(action: action ?? {}) {
360+
ZStack {
361+
content
362+
if isLoading {
363+
Capsule()
364+
.fill(backgroundColor.opacity(0.6))
365+
ProgressView()
366+
.scaleEffect(0.6)
367+
.tint(textColor)
368+
}
369+
}
361370
}
362371
.buttonStyle(.plain)
372+
.disabled(!isEnabled || isLoading || action == nil)
373+
.allowsHitTesting(isEnabled && !isLoading && action != nil)
374+
.opacity(isEnabled && !isLoading ? 1.0 : 0.6)
363375
.accessibilityElement(children: .combine)
364376
.accessibilityLabel(accessibilityLabel)
365377
.accessibilityHint(accessibilityHint ?? "")
366-
367378
}
368379
}
369380

0 commit comments

Comments
 (0)