Use a VStack for invite buttons when the HStack doesn't fit. (#5403)
The Accept/Decline labels were being wrapped onto 2 lines.
This commit is contained in:
@@ -58,9 +58,9 @@ struct HomeScreenInviteCell: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private var mainContent: some View {
|
private var mainContent: some View {
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 14) {
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
HStack(alignment: .firstTextBaseline, spacing: 16) {
|
HStack(alignment: .firstTextBaseline, spacing: 16) {
|
||||||
textualContent
|
textualContent
|
||||||
@@ -74,12 +74,14 @@ struct HomeScreenInviteCell: View {
|
|||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.accessibilityElement(children: .combine)
|
.accessibilityElement(children: .combine)
|
||||||
|
|
||||||
buttons
|
ViewThatFits {
|
||||||
.padding(.top, 14)
|
HStack(spacing: 12) { buttons }
|
||||||
.padding(.trailing, 22)
|
VStack(spacing: 16) { Group(subviews: buttons) { ForEach($0.reversed()) { $0 } } }
|
||||||
|
}
|
||||||
|
.padding(.trailing, 22)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var inviterView: some View {
|
private var inviterView: some View {
|
||||||
if let inviter = room.inviter,
|
if let inviter = room.inviter,
|
||||||
@@ -108,24 +110,23 @@ struct HomeScreenInviteCell: View {
|
|||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
private var buttons: some View {
|
private var buttons: some View {
|
||||||
HStack(spacing: 12) {
|
Button {
|
||||||
Button {
|
context.send(viewAction: .declineInvite(roomIdentifier: room.id))
|
||||||
context.send(viewAction: .declineInvite(roomIdentifier: room.id))
|
} label: {
|
||||||
} label: {
|
Text(L10n.actionDecline)
|
||||||
Text(L10n.actionDecline)
|
.frame(maxWidth: .infinity)
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
}
|
|
||||||
.buttonStyle(.compound(.secondary, size: .medium))
|
|
||||||
|
|
||||||
Button {
|
|
||||||
context.send(viewAction: .acceptInvite(roomIdentifier: room.id))
|
|
||||||
} label: {
|
|
||||||
Text(L10n.actionAccept)
|
|
||||||
.frame(maxWidth: .infinity)
|
|
||||||
}
|
|
||||||
.buttonStyle(.compound(.primary, size: .medium))
|
|
||||||
}
|
}
|
||||||
|
.buttonStyle(.compound(.secondary, size: .medium))
|
||||||
|
|
||||||
|
Button {
|
||||||
|
context.send(viewAction: .acceptInvite(roomIdentifier: room.id))
|
||||||
|
} label: {
|
||||||
|
Text(L10n.actionAccept)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
}
|
||||||
|
.buttonStyle(.compound(.primary, size: .medium))
|
||||||
}
|
}
|
||||||
|
|
||||||
private var separator: some View {
|
private var separator: some View {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user