Skip to content

Commit

Permalink
Share slide fixes
Browse files Browse the repository at this point in the history
- use attributed string instead of displaying markup
- fix layout issue when there's an image overlay
  • Loading branch information
tonisevener committed Nov 20, 2024
1 parent 88e7b9e commit 4c51bde
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,8 +38,6 @@ struct WMFYearInReviewShareableSlideView: View {

if let imageOverlay {
Image(imageOverlay, bundle: .module)
.padding(.horizontal, 100)
.padding(.vertical, 50)
}

if let overlayText = textOverlay {
Expand All @@ -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 {
Expand Down

0 comments on commit 4c51bde

Please sign in to comment.