@@ -50,6 +50,12 @@ final class TopBannerView: UIView {
5050 return stackView
5151 } ( )
5252
53+ private let labelHolderStackView : UIStackView = {
54+ let stackView = UIStackView ( )
55+ stackView. axis = . horizontal
56+ return stackView
57+ } ( )
58+
5359 // StackView to hold the action buttons. Needed to change the axis on larger accessibility traits
5460 private let buttonsStackView = UIStackView ( )
5561
@@ -114,6 +120,10 @@ private extension TopBannerView {
114120
115121 zip ( viewModel. actionButtons, actionButtons) . forEach { buttonInfo, button in
116122 button. setTitle ( buttonInfo. title, for: . normal)
123+ button. titleLabel? . font = . boldSystemFont( ofSize: titleLabel. font. pointSize)
124+ // Overrides the general .applyLinkButtonStyle() with pink color
125+ // pecCkj-fa-p2
126+ button. setTitleColor ( UIColor . withColorStudio ( . pink) , for: . normal)
117127 button. on ( . touchUpInside, call: { _ in buttonInfo. action ( button) } )
118128 }
119129 }
@@ -141,7 +151,7 @@ private extension TopBannerView {
141151
142152 func createMainStackView( with viewModel: TopBannerViewModel ) -> UIStackView {
143153 let iconInformationStackView = createIconInformationStackView ( with: viewModel)
144- let mainStackView = UIStackView ( arrangedSubviews: [ iconInformationStackView, createBorderView ( ) ] )
154+ let mainStackView = UIStackView ( arrangedSubviews: [ createBorderView ( ) , iconInformationStackView, createBorderView ( ) ] )
145155 if isActionEnabled {
146156 configureActionStackView ( with: viewModel)
147157 mainStackView. addArrangedSubview ( actionStackView)
@@ -167,6 +177,18 @@ private extension TopBannerView {
167177 return iconInformationStackView
168178 }
169179
180+ func createLabelHolderStackView( ) -> UIStackView {
181+ labelHolderStackView. addArrangedSubviews ( [
182+ createSeparatorView ( height: Constants . labelHolderHeight, width: Constants . labelHolderLeftMargin) ,
183+ infoLabel,
184+ createSeparatorView ( height: Constants . labelHolderHeight, width: Constants . labelHolderRightMargin)
185+ ] )
186+ labelHolderStackView. spacing = Constants . labelHolderSpacing
187+ infoLabel. adjustsFontSizeToFitWidth = true
188+
189+ return labelHolderStackView
190+ }
191+
170192 func createInformationStackView( with viewModel: TopBannerViewModel ) -> UIStackView {
171193 let topActionButton = topButton ( for: viewModel. topButton)
172194 titleStackView. addArrangedSubviews ( [ titleLabel, topActionButton] . compactMap { $0 } )
@@ -179,7 +201,8 @@ private extension TopBannerView {
179201 // titleStackView will hidden if there is no title
180202 titleStackView. isHidden = viewModel. title == nil || viewModel. title? . isEmpty == true
181203
182- let informationStackView = UIStackView ( arrangedSubviews: [ titleStackView, infoLabel] )
204+ let informationStackView = UIStackView ( arrangedSubviews: [ titleStackView, createLabelHolderStackView ( ) ] )
205+
183206 informationStackView. axis = . vertical
184207 informationStackView. spacing = 9
185208
@@ -225,6 +248,10 @@ private extension TopBannerView {
225248 return UIView . createBorderView ( )
226249 }
227250
251+ func createSeparatorView( height: CGFloat , width: CGFloat ) -> UIView {
252+ return UIView . createSeparatorView ( height: height, width: width)
253+ }
254+
228255 func topButton( for buttonType: TopBannerViewModel . TopButtonType ) -> UIButton ? {
229256 switch buttonType {
230257 case . chevron:
@@ -293,14 +320,14 @@ private extension TopBannerView {
293320 func updateExpandCollapseState( isExpanded: Bool ) {
294321 let image = isExpanded ? UIImage . chevronUpImage: UIImage . chevronDownImage
295322 expandCollapseButton. setImage ( image, for: . normal)
296- infoLabel . isHidden = !isExpanded
323+ labelHolderStackView . isHidden = !isExpanded
297324 if isActionEnabled {
298325 actionStackView. isHidden = !isExpanded
299326 }
300327 titleStackView. accessibilityHint = isExpanded ? Localization . collapseHint : Localization . expandHint
301328 titleStackView. accessibilityValue = isExpanded ? Localization . expanded : Localization . collapsed
302329
303- let accessibleView = isExpanded ? infoLabel : nil
330+ let accessibleView = isExpanded ? labelHolderStackView : nil
304331 UIAccessibility . post ( notification: . layoutChanged, argument: accessibleView)
305332 }
306333}
@@ -316,3 +343,14 @@ private extension TopBannerView {
316343 static let dismissHint = NSLocalizedString ( " Double-tap to dismiss " , comment: " Accessibility hint to dismiss a banner " )
317344 }
318345}
346+
347+ // MARK: - Constants
348+ //
349+ private extension TopBannerView {
350+ enum Constants {
351+ static let labelHolderHeight : CGFloat = 48.0
352+ static let labelHolderLeftMargin : CGFloat = 0.0
353+ static let labelHolderRightMargin : CGFloat = 24.0
354+ static let labelHolderSpacing : CGFloat = 1.0
355+ }
356+ }
0 commit comments