From e44e65bfcbb015264db5b64ea01863d4328a8be8 Mon Sep 17 00:00:00 2001 From: Winnie Teichmann <4530+thatswinnie@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:02:24 +0200 Subject: [PATCH] Refactor FXIOS-7476 [v120] Highlights card without reviews shown (#16610) * Check for existing highlights before showing card * Update font, size and weight for highlights card --- Client/Frontend/Fakespot/FakespotViewModel.swift | 2 +- .../Fakespot/Views/FakespotHighlightGroupView.swift | 2 +- .../Fakespot/Views/FakespotHighlightsCardView.swift | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Client/Frontend/Fakespot/FakespotViewModel.swift b/Client/Frontend/Fakespot/FakespotViewModel.swift index d84e348fe8ee..a23323fc93a3 100644 --- a/Client/Frontend/Fakespot/FakespotViewModel.swift +++ b/Client/Frontend/Fakespot/FakespotViewModel.swift @@ -109,7 +109,7 @@ class FakespotViewModel { } var highlightsCardViewModel: FakespotHighlightsCardViewModel? { - guard let highlights = state.productData?.highlights else { return nil } + guard let highlights = state.productData?.highlights, !highlights.items.isEmpty else { return nil } return FakespotHighlightsCardViewModel(highlights: highlights.items) } diff --git a/Client/Frontend/Fakespot/Views/FakespotHighlightGroupView.swift b/Client/Frontend/Fakespot/Views/FakespotHighlightGroupView.swift index 754b4928a45a..2e20b27156c5 100644 --- a/Client/Frontend/Fakespot/Views/FakespotHighlightGroupView.swift +++ b/Client/Frontend/Fakespot/Views/FakespotHighlightGroupView.swift @@ -25,7 +25,7 @@ class FakespotHighlightGroupView: UIView, ThemeApplicable, Notifiable { private lazy var titleLabel: UILabel = .build { label in label.adjustsFontForContentSizeCategory = true label.font = DefaultDynamicFontHelper.preferredFont( - withTextStyle: .headline, + withTextStyle: .subheadline, size: UX.titleFontSize, weight: .semibold) label.numberOfLines = 0 diff --git a/Client/Frontend/Fakespot/Views/FakespotHighlightsCardView.swift b/Client/Frontend/Fakespot/Views/FakespotHighlightsCardView.swift index 769556b47e38..c79e1d14ae8d 100644 --- a/Client/Frontend/Fakespot/Views/FakespotHighlightsCardView.swift +++ b/Client/Frontend/Fakespot/Views/FakespotHighlightsCardView.swift @@ -39,7 +39,7 @@ struct FakespotHighlightsCardViewModel { class FakespotHighlightsCardView: UIView, ThemeApplicable { private struct UX { - static let titleFontSize: CGFloat = 17 + static let titleFontSize: CGFloat = 15 static let buttonFontSize: CGFloat = 16 static let buttonCornerRadius: CGFloat = 12 static let buttonHorizontalInset: CGFloat = 16 @@ -57,9 +57,9 @@ class FakespotHighlightsCardView: UIView, ThemeApplicable { private lazy var titleLabel: UILabel = .build { label in label.adjustsFontForContentSizeCategory = true - label.font = DefaultDynamicFontHelper.preferredFont( - withTextStyle: .headline, - size: UX.titleFontSize) + label.font = DefaultDynamicFontHelper.preferredFont(withTextStyle: .subheadline, + size: UX.titleFontSize, + weight: .semibold) label.numberOfLines = 0 }