Digital ACT-191 ONEAPP-7016 story: updating surface for all childviews
This commit is contained in:
parent
890ad97f0a
commit
f043ac74d3
@ -235,7 +235,7 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI
|
|||||||
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: CalendarHeaderReusableView.identifier, for: indexPath) as? CalendarHeaderReusableView else {
|
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: CalendarHeaderReusableView.identifier, for: indexPath) as? CalendarHeaderReusableView else {
|
||||||
return UICollectionReusableView()
|
return UICollectionReusableView()
|
||||||
}
|
}
|
||||||
header.configure(with: true)
|
header.configure(with: surface)
|
||||||
return header
|
return header
|
||||||
} else {
|
} else {
|
||||||
// Footer
|
// Footer
|
||||||
@ -243,7 +243,7 @@ extension CalendarBase: UICollectionViewDelegate, UICollectionViewDataSource, UI
|
|||||||
guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: CalendarFooterReusableView.identifier, for: indexPath) as? CalendarFooterReusableView else {
|
guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: CalendarFooterReusableView.identifier, for: indexPath) as? CalendarFooterReusableView else {
|
||||||
return UICollectionReusableView()
|
return UICollectionReusableView()
|
||||||
}
|
}
|
||||||
footer.configure(with: indicators)
|
footer.configure(with: surface, indicators: indicators)
|
||||||
return footer
|
return footer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ final class CalendarDateCollectionViewCell: UICollectionViewCell {
|
|||||||
|
|
||||||
func configure(with surface: Surface, indicators: [CalendarBase.CalendarIndicatorModel], text: String, indicatorCount: Int) {
|
func configure(with surface: Surface, indicators: [CalendarBase.CalendarIndicatorModel], text: String, indicatorCount: Int) {
|
||||||
addSubview(dateView)
|
addSubview(dateView)
|
||||||
|
dateView.surface = surface
|
||||||
dateView.numberLabel.text = text
|
dateView.numberLabel.text = text
|
||||||
dateView.indicatorCount = indicatorCount
|
dateView.indicatorCount = indicatorCount
|
||||||
dateView.dateIndicators = indicators
|
dateView.dateIndicators = indicators
|
||||||
@ -120,7 +121,7 @@ private class DateView : View {
|
|||||||
|
|
||||||
// Indicators
|
// Indicators
|
||||||
containerView.addSubview(stackView)
|
containerView.addSubview(stackView)
|
||||||
let topPos = containerSize.height * 0.6
|
let topPos = containerSize.height * 0.7
|
||||||
stackView.pinTop(topPos).pinBottom().pinTopGreaterThanOrEqualTo().pinTrailingLessThanOrEqualTo().pinCenterY()
|
stackView.pinTop(topPos).pinBottom().pinTopGreaterThanOrEqualTo().pinTrailingLessThanOrEqualTo().pinCenterY()
|
||||||
stackView.centerXAnchor.constraint(equalTo: centerXAnchor).activate()
|
stackView.centerXAnchor.constraint(equalTo: centerXAnchor).activate()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,14 +127,14 @@ private class LegendCollectionViewCell: UICollectionViewCell {
|
|||||||
|
|
||||||
private let indicatorColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark)
|
private let indicatorColorConfiguration = SurfaceColorConfiguration(VDSColor.elementsSecondaryOnlight, VDSColor.elementsSecondaryOndark)
|
||||||
|
|
||||||
private var title = Label().with {
|
private var title: Label = Label().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.textAlignment = .left
|
$0.textAlignment = .left
|
||||||
$0.numberOfLines = 1
|
$0.numberOfLines = 1
|
||||||
$0.textStyle = .bodySmall
|
$0.textStyle = .bodySmall
|
||||||
$0.backgroundColor = .clear
|
|
||||||
$0.isAccessibilityElement = false
|
$0.isAccessibilityElement = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private var legendIndicatorWrapper: View = View().with {
|
private var legendIndicatorWrapper: View = View().with {
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.backgroundColor = .clear
|
$0.backgroundColor = .clear
|
||||||
@ -180,6 +180,7 @@ private class LegendCollectionViewCell: UICollectionViewCell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateTitle(text: String, color: UIColor, surface: Surface, clearFullcircle: Bool, drawSemiCircle: Bool) {
|
func updateTitle(text: String, color: UIColor, surface: Surface, clearFullcircle: Bool, drawSemiCircle: Bool) {
|
||||||
|
title.surface = surface
|
||||||
title.text = text
|
title.text = text
|
||||||
title.textColor = textColorConfiguration.getColor(surface)
|
title.textColor = textColorConfiguration.getColor(surface)
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,7 @@ open class CalendarHeaderView: View {
|
|||||||
.pinLeading()
|
.pinLeading()
|
||||||
.pinTrailing()
|
.pinTrailing()
|
||||||
.pinBottom(VDSLayout.space1X)
|
.pinBottom(VDSLayout.space1X)
|
||||||
|
stackView.centerXAnchor.constraint(equalTo: containerView.centerXAnchor).activate()
|
||||||
|
|
||||||
// month label view, previous and next buttons
|
// month label view, previous and next buttons
|
||||||
stackView.addArrangedSubview(monthView)
|
stackView.addArrangedSubview(monthView)
|
||||||
@ -157,11 +158,14 @@ open class CalendarHeaderView: View {
|
|||||||
stackView.addArrangedSubview(daysCollectionView)
|
stackView.addArrangedSubview(daysCollectionView)
|
||||||
daysCollectionView.widthAnchor.constraint(equalTo: widthAnchor).activate()
|
daysCollectionView.widthAnchor.constraint(equalTo: widthAnchor).activate()
|
||||||
daysCollectionView.heightAnchor.constraint(equalTo: monthView.heightAnchor).activate()
|
daysCollectionView.heightAnchor.constraint(equalTo: monthView.heightAnchor).activate()
|
||||||
print("daysOfWeek: \(daysOfWeek)")
|
daysCollectionView.centerXAnchor.constraint(equalTo: containerView.centerXAnchor).activate()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
monthYearLabel.surface = surface
|
||||||
|
previousButton.surface = surface
|
||||||
|
nextButton.surface = surface
|
||||||
daysCollectionView.reloadData()
|
daysCollectionView.reloadData()
|
||||||
monthYearLabel.text = "May 2024"
|
monthYearLabel.text = "May 2024"
|
||||||
monthYearLabel.textColor = monthYearLabelTextColorConfiguration.getColor(surface)
|
monthYearLabel.textColor = monthYearLabelTextColorConfiguration.getColor(surface)
|
||||||
|
|||||||
@ -24,7 +24,8 @@ class CalendarHeaderReusableView: UICollectionReusableView {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(with color: Bool) {
|
func configure(with surface: Surface) {
|
||||||
|
headerView.surface = surface
|
||||||
addSubview(headerView)
|
addSubview(headerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,8 +50,9 @@ class CalendarFooterReusableView: UICollectionReusableView {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(with indicators: [CalendarBase.CalendarIndicatorModel]) {
|
func configure(with surface: Surface, indicators: [CalendarBase.CalendarIndicatorModel]) {
|
||||||
footerView.items = indicators
|
footerView.items = indicators
|
||||||
|
footerView.surface = surface
|
||||||
addSubview(footerView)
|
addSubview(footerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user