mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Simplify how we build bubbles for previewing purposes, make use of the new bubbleBackground modifier.
This commit is contained in:
committed by
Stefan Ceriu
parent
681daf50ea
commit
c97dcc18f2
@@ -189,18 +189,18 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
|
||||
ForEach(htmlStrings, id: \.self) { htmlString in
|
||||
if let attributedString = attributedStringBuilder.fromHTML(htmlString) {
|
||||
FormattedBodyText(attributedString: attributedString)
|
||||
.previewBubble()
|
||||
.bubbleBackground()
|
||||
}
|
||||
}
|
||||
FormattedBodyText(attributedString: AttributedString("Some plain text wrapped in an AttributedString."))
|
||||
.previewBubble()
|
||||
.bubbleBackground()
|
||||
FormattedBodyText(text: "Some plain text that's not an attributed component.")
|
||||
.previewBubble()
|
||||
.bubbleBackground()
|
||||
FormattedBodyText(text: "Some plain text that's not an attributed component. This one is really long.")
|
||||
.previewBubble()
|
||||
.bubbleBackground()
|
||||
|
||||
FormattedBodyText(text: "❤️", boostEmojiSize: true)
|
||||
.previewBubble()
|
||||
.bubbleBackground()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
@@ -208,19 +208,3 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
}
|
||||
|
||||
private struct PreviewBubbleModifier: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.padding(8)
|
||||
.background(Color.compound._bgBubbleOutgoing)
|
||||
.cornerRadius(12)
|
||||
.environmentObject(TimelineViewModel.mock.context)
|
||||
}
|
||||
}
|
||||
|
||||
private extension View {
|
||||
func previewBubble() -> some View {
|
||||
modifier(PreviewBubbleModifier())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user