Digital ACT191 story ONEAPP-7718 - Bugfix for headlineBody legacy mapping to titleLockup. Remove clipsToBounds to allow shadows.

This commit is contained in:
Scott Pfeil 2024-05-07 18:52:33 -04:00
parent 07db477416
commit 861c6fd4d4
3 changed files with 20 additions and 7 deletions

View File

@ -92,19 +92,31 @@ public struct DeprecatedHeadlineBodyHelper {
public func createTitleLockupModel(defaultStyle: HeadlineBodyModel.Style = .header, headlineBody: HeadlineBodyModel) throws -> TitleLockupModel {
guard let headline = headlineBody.headline else { throw ModelRegistry.Error.decoderOther(message: "headline is required for this use case.") }
let body = headlineBody.body
var defaultHeadlineStyle: Styler.Font
var defaultBodyStyle: Styler.Font
switch headlineBody.style ?? defaultStyle {
case .landingHeader:
headline.fontStyle = Styler.Font.RegularTitle2XLarge
body?.fontStyle = Styler.Font.RegularTitleMedium
defaultHeadlineStyle = Styler.Font.RegularTitle2XLarge
defaultBodyStyle = Styler.Font.RegularTitleMedium
case .itemHeader:
headline.fontStyle = Styler.Font.BoldTitleLarge
body?.fontStyle = Styler.Font.RegularBodyLarge
defaultHeadlineStyle = Styler.Font.BoldTitleLarge
defaultBodyStyle = Styler.Font.RegularBodyLarge
default:
headline.fontStyle = Styler.Font.RegularTitleXLarge
body?.fontStyle = Styler.Font.RegularTitleMedium
defaultHeadlineStyle = Styler.Font.RegularTitleXLarge
defaultBodyStyle = Styler.Font.RegularTitleMedium
}
if headline.fontStyle == nil {
headline.fontStyle = defaultHeadlineStyle
}
if body?.fontStyle == nil {
body?.fontStyle = defaultBodyStyle
}
let model = TitleLockupModel(title: headline, subTitle: body)
model.id = headlineBody.id
if let textAlignment = headline.textAlignment ?? body?.textAlignment,
textAlignment == .center {
model.textAlignment = .center
}
return model
}

View File

@ -22,7 +22,7 @@ open class CarouselItem: MoleculeCollectionViewCell, CarouselItemProtocol {
open override func setupView() {
super.setupView()
clipsToBounds = true
clipsToBounds = false
// Covers the card when peaking.
peakingCover.backgroundColor = .white

View File

@ -125,6 +125,7 @@ open class Carousel: View {
collectionView.dataSource = self
collectionView.delegate = self
collectionView.bounces = false
collectionView.clipsToBounds = false
addSubview(collectionView)
bottomPin = NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)?[ConstraintBot] as? NSLayoutConstraint
collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300)