Cherry pick some missed Compound/layout changes that ended up in the Xcode 15 PR. (#2120)

Fix broken Settings screen snapshots.
This commit is contained in:
Doug
2023-11-20 11:06:24 +00:00
committed by GitHub
parent fc7b0038bc
commit f2391394a7
15 changed files with 31 additions and 62 deletions
@@ -33,6 +33,7 @@ struct MenuSheetLabelStyle: LabelStyle {
}
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
.fixedSize(horizontal: false, vertical: true)
.padding(16)
}
}
@@ -34,6 +34,7 @@ struct MessageComposer: View {
@FocusState private var focused: Bool
@State private var composerTranslation: CGFloat = 0
private let composerShape = RoundedRectangle(cornerRadius: 21, style: .circular)
var body: some View {
VStack(spacing: 0) {
@@ -41,16 +42,14 @@ struct MessageComposer: View {
resizeGrabber
}
let borderRadius: CGFloat = 21
mainContent
.padding(.horizontal, 12.0)
.clipShape(RoundedRectangle(cornerRadius: borderRadius))
.clipShape(composerShape)
.background {
let roundedRectangle = RoundedRectangle(cornerRadius: borderRadius)
ZStack {
roundedRectangle
composerShape
.fill(Color.compound.bgSubtleSecondary)
roundedRectangle
composerShape
.stroke(Color.compound._borderTextFieldFocused, lineWidth: 0.5)
}
}
@@ -135,8 +134,7 @@ private struct MessageComposerReplyHeader: View {
TimelineReplyView(placement: .composer, timelineItemReplyDetails: replyDetails)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(4.0)
.background(Color.compound.bgCanvasDefault)
.cornerRadius(13.0)
.background(.compound.bgCanvasDefault, in: RoundedRectangle(cornerRadius: 13, style: .circular))
.overlay(alignment: .topTrailing) {
Button(action: action) {
CompoundIcon(\.close, size: .small, relativeTo: .compound.bodySMSemibold)
@@ -31,7 +31,7 @@ struct RoomHeaderView: View {
}
// Leading align whilst using the principal toolbar position.
.frame(maxWidth: .infinity, alignment: .leading)
// Using a button stops is from getting truncated in the navigation bar
// Using a button stops it from getting truncated in the navigation bar
.onTapGesture {
context.send(viewAction: .displayRoomDetails)
}
@@ -14,7 +14,7 @@
// limitations under the License.
//
import Foundation
import Compound
import SwiftUI
struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
@@ -28,16 +28,17 @@ struct NoticeRoomTimelineView: View, TextBasedRoomTimelineViewProtocol {
// Spacing: 6 = label spacing - formatted text padding
HStack(alignment: .firstTextBaseline, spacing: 6.0) {
Image(systemName: "info.bubble").padding(.top, 2.0)
.foregroundColor(.compound.iconSecondary)
Label {
if let attributedString = timelineItem.content.formattedBody {
FormattedBodyText(attributedString: attributedString, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle))
} else {
FormattedBodyText(text: timelineItem.content.body, additionalWhitespacesCount: timelineItem.additionalWhitespaces(timelineStyle: timelineStyle))
}
} icon: {
CompoundIcon(\.info, size: .small, relativeTo: .compound.bodyLG)
.foregroundColor(.compound.iconSecondary)
}
.labelStyle(.custom(spacing: 6.0, alignment: .top))
.padding(.leading, 4) // Trailing padding is provided by FormattedBodyText
}
}
@@ -14,6 +14,7 @@
// limitations under the License.
//
import Compound
import SwiftUI
struct UnsupportedRoomTimelineView: View {
@@ -31,7 +32,7 @@ struct UnsupportedRoomTimelineView: View {
.font(.compound.bodySM)
}
} icon: {
Image(systemName: "exclamationmark.triangle")
CompoundIcon(\.warning, size: .small, relativeTo: .compound.bodyLG)
}
.labelStyle(RoomTimelineViewLabelStyle())
}