mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Only make toolbar buttons prominent when tinted. (#6188)
This commit is contained in:
@@ -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,16 +58,28 @@ struct ToolbarButton: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if #available(iOS 26, *) {
|
if #available(iOS 26, *) {
|
||||||
Button(action: action) {
|
if let tint = role.tint {
|
||||||
role.icon
|
glassButton
|
||||||
.accessibilityLabel(role.title)
|
.tint(tint)
|
||||||
|
.backportButtonStyleGlassProminent()
|
||||||
|
} else {
|
||||||
|
glassButton
|
||||||
}
|
}
|
||||||
.tint(role.tint)
|
|
||||||
.backportButtonStyleGlassProminent()
|
|
||||||
} else {
|
} else {
|
||||||
Button(role.title, action: action)
|
flatButton
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var glassButton: some View {
|
||||||
|
Button(action: action) {
|
||||||
|
role.icon
|
||||||
|
.accessibilityLabel(role.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var flatButton: some View {
|
||||||
|
Button(role.title, action: action)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ToolbarButton_Previews: PreviewProvider, TestablePreview {
|
struct ToolbarButton_Previews: PreviewProvider, TestablePreview {
|
||||||
|
|||||||
Reference in New Issue
Block a user