From 4c51bdeabfafd23acf6c82d03f764e9dde9ea044 Mon Sep 17 00:00:00 2001 From: Toni Sevener Date: Wed, 20 Nov 2024 16:22:43 -0600 Subject: [PATCH] Share slide fixes - use attributed string instead of displaying markup - fix layout issue when there's an image overlay --- .../WMFYearInReviewShareableSlideView.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/WMFComponents/Sources/WMFComponents/Components/Year in Review/WMFYearInReviewShareableSlideView.swift b/WMFComponents/Sources/WMFComponents/Components/Year in Review/WMFYearInReviewShareableSlideView.swift index d4853cbbe1..21bdc1c460 100644 --- a/WMFComponents/Sources/WMFComponents/Components/Year in Review/WMFYearInReviewShareableSlideView.swift +++ b/WMFComponents/Sources/WMFComponents/Components/Year in Review/WMFYearInReviewShareableSlideView.swift @@ -14,6 +14,10 @@ struct WMFYearInReviewShareableSlideView: View { var slideTitle: String var slideSubtitle: String var hashtag: String + + private func subtitleAttributedString() -> AttributedString { + return (try? AttributedString(markdown: slideSubtitle)) ?? AttributedString(slideSubtitle) + } var body: some View { GeometryReader { geometry in @@ -34,8 +38,6 @@ struct WMFYearInReviewShareableSlideView: View { if let imageOverlay { Image(imageOverlay, bundle: .module) - .padding(.horizontal, 100) - .padding(.vertical, 50) } if let overlayText = textOverlay { @@ -49,14 +51,14 @@ struct WMFYearInReviewShareableSlideView: View { Text(slideTitle) .font(Font(WMFFont.for(.boldTitle1, compatibleWith: UITraitCollection(preferredContentSizeCategory: .medium)))) .foregroundStyle(Color(uiColor: theme.text)) - Text(slideSubtitle) + Text(subtitleAttributedString()) .font(Font(WMFFont.for(.title3, compatibleWith: UITraitCollection(preferredContentSizeCategory: .medium)))) .foregroundStyle(Color(uiColor: theme.text)) + .accentColor(Color(uiColor: theme.link)) } .padding(28) } - Spacer(minLength: 10) HStack {