mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Give search breadcrumbs a consistent row height
Query and room breadcrumbs reserved slightly different heights, and rooms without a description collapsed further. Both now reserve the space of a title and subtitle so every row lines up.
This commit is contained in:
@@ -307,17 +307,21 @@ private struct SearchScreenRoomCell: View {
|
||||
HStack(spacing: 16) {
|
||||
avatar
|
||||
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(room.title)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
ZStack(alignment: .leading) {
|
||||
SearchScreenRowHeightPlaceholder()
|
||||
|
||||
if !room.description.isEmpty {
|
||||
Text(room.description)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(room.title)
|
||||
.font(.compound.bodyLGSemibold)
|
||||
.foregroundStyle(.compound.textPrimary)
|
||||
.lineLimit(1)
|
||||
|
||||
if !room.description.isEmpty {
|
||||
Text(room.description)
|
||||
.font(.compound.bodyMD)
|
||||
.foregroundStyle(.compound.textSecondary)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -391,9 +395,7 @@ private struct SearchScreenQueryCell: View {
|
||||
.accessibilityHidden(true)
|
||||
|
||||
ZStack(alignment: .leading) {
|
||||
// Hidden text with 2 lines to match the height of the room rows, scaling with dynamic text.
|
||||
Text(verbatim: " \n ")
|
||||
.font(.compound.bodyLG)
|
||||
SearchScreenRowHeightPlaceholder()
|
||||
|
||||
Text(query)
|
||||
.font(.compound.bodyLG)
|
||||
@@ -414,6 +416,20 @@ private struct SearchScreenQueryCell: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reserves the height of a title and subtitle so every row matches, scaling with dynamic type.
|
||||
private struct SearchScreenRowHeightPlaceholder: View {
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(verbatim: " ")
|
||||
.font(.compound.bodyLGSemibold)
|
||||
Text(verbatim: " ")
|
||||
.font(.compound.bodyMD)
|
||||
}
|
||||
.hidden()
|
||||
.accessibilityHidden(true)
|
||||
}
|
||||
}
|
||||
|
||||
private struct SearchScreenRemoveBreadcrumbButton: View {
|
||||
let action: () -> Void
|
||||
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8c8463b5471ab15009f661652b237cc61f540eea5c4c7d51d26e462487b52892
|
||||
size 109550
|
||||
oid sha256:ea160bb2a3ace2dbb6aeed3ba459842e49acb335fb71bc4c873f9bf9f2741e01
|
||||
size 109546
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:768478153a8dfe9d455fbb87269e79c3698c56cc3515ccb4b8c610ec91f204e6
|
||||
size 112054
|
||||
oid sha256:e7ac0977610703092a01b08c59e788a39044bf353906c59a67649e91d0e93485
|
||||
size 112055
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34c519522df41c5b63319d85a14bea386321922e5e208988d258f2df07ad7578
|
||||
size 63101
|
||||
oid sha256:c312336759e9ed1f5bc8b4863fa972d17f53f484b56755da6e3d90860e78051e
|
||||
size 63062
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:cdc345436b48af82e9543daffc720db8d1c91bb10caf16e490eef4eecf2a4af5
|
||||
size 67108
|
||||
oid sha256:3a32b41165b5e09a15a2e606e21690812a3a0c4bebc1564c05e44a200214c6bc
|
||||
size 67114
|
||||
|
||||
Reference in New Issue
Block a user