mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Fix the space filters button on iPad using a Toggle for default styling.
This commit is contained in:
@@ -131,33 +131,18 @@ struct HomeScreen: View {
|
|||||||
var action: () -> Void
|
var action: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if #available(iOS 26, *) {
|
// Use a Toggle to let the system handle the selection style for both the Liquid Glass
|
||||||
if selected {
|
// button on iPhone, along with the plain button used in the sidebar on iPad/Mac.
|
||||||
content
|
Toggle(isOn: .constant(selected)) {
|
||||||
.backportButtonStyleGlassProminent()
|
|
||||||
.tint(.compound.bgActionPrimaryRest)
|
|
||||||
} else {
|
|
||||||
content
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if selected {
|
|
||||||
content
|
|
||||||
.buttonStyle(.compound(.primary, size: .toolbarIcon))
|
|
||||||
} else {
|
|
||||||
content
|
|
||||||
.buttonStyle(.compound(.tertiary, size: .toolbarIcon))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var content: some View {
|
|
||||||
Button {
|
|
||||||
action()
|
|
||||||
} label: {
|
|
||||||
CompoundIcon(\.filter)
|
CompoundIcon(\.filter)
|
||||||
|
.foregroundStyle(selected ? .compound.iconOnSolidPrimary : .compound.iconPrimary)
|
||||||
|
}
|
||||||
|
.overlay {
|
||||||
|
// The tap gesture is ignored when applied to the toggle so apply it to an overlay instead.
|
||||||
|
Color.black.opacity(0.001)
|
||||||
|
.onTapGesture(perform: action)
|
||||||
}
|
}
|
||||||
.accessibilityLabel(L10n.screenRoomlistYourSpaces)
|
.accessibilityLabel(L10n.screenRoomlistYourSpaces)
|
||||||
.accessibilityAddTraits(selected ? .isSelected : [])
|
|
||||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.spaceFilters)
|
.accessibilityIdentifier(A11yIdentifiers.homeScreen.spaceFilters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user