Only make toolbar buttons prominent when tinted. (#6188)

This commit is contained in:
Doug
2026-09-23 11:21:47 +01:00
committed by GitHub
parent 550b14718b
commit 47f881c507
@@ -41,10 +41,10 @@ struct ToolbarButton: View {
} }
} }
var tint: Color { var tint: Color? {
switch self { switch self {
case .cancel: case .cancel:
.clear nil
case .confirm: case .confirm:
.compound.bgAccentRest .compound.bgAccentRest
case .destructive: case .destructive:
@@ -58,15 +58,27 @@ struct ToolbarButton: View {
var body: some View { var body: some View {
if #available(iOS 26, *) { if #available(iOS 26, *) {
if let tint = role.tint {
glassButton
.tint(tint)
.backportButtonStyleGlassProminent()
} else {
glassButton
}
} else {
flatButton
}
}
private var glassButton: some View {
Button(action: action) { Button(action: action) {
role.icon role.icon
.accessibilityLabel(role.title) .accessibilityLabel(role.title)
} }
.tint(role.tint)
.backportButtonStyleGlassProminent()
} else {
Button(role.title, action: action)
} }
private var flatButton: some View {
Button(role.title, action: action)
} }
} }