mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +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 {
|
||||
case .cancel:
|
||||
.clear
|
||||
nil
|
||||
case .confirm:
|
||||
.compound.bgAccentRest
|
||||
case .destructive:
|
||||
@@ -58,16 +58,28 @@ struct ToolbarButton: View {
|
||||
|
||||
var body: some View {
|
||||
if #available(iOS 26, *) {
|
||||
Button(action: action) {
|
||||
role.icon
|
||||
.accessibilityLabel(role.title)
|
||||
if let tint = role.tint {
|
||||
glassButton
|
||||
.tint(tint)
|
||||
.backportButtonStyleGlassProminent()
|
||||
} else {
|
||||
glassButton
|
||||
}
|
||||
.tint(role.tint)
|
||||
.backportButtonStyleGlassProminent()
|
||||
} 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 {
|
||||
|
||||
Reference in New Issue
Block a user