Some styling in pick-server-header (#690)

This commit is contained in:
Nathan Mattes 2022-12-15 21:49:01 +01:00
parent 00a05514a9
commit 4ce111164d
2 changed files with 19 additions and 3 deletions

View File

@ -23,8 +23,24 @@ extension CategoryPickerSection {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: PickServerCategoryCollectionViewCell.self), for: indexPath) as! PickServerCategoryCollectionViewCell
cell.categoryView.titleLabel.text = item.title
cell.observe(\.isSelected, options: [.initial, .new]) { cell, _ in
// cell.categoryView.highlightedIndicatorView.alpha = cell.isSelected ? 1 : 0
cell.categoryView.titleLabel.textColor = cell.isSelected ? Asset.Colors.Label.primary.color : Asset.Colors.Label.secondary.color
let textColor: UIColor
let backgroundColor: UIColor
let borderColor: UIColor
if cell.isSelected {
textColor = .white
backgroundColor = Asset.Colors.Primary._700.color
borderColor = Asset.Colors.Primary._700.color
} else {
textColor = .label
backgroundColor = .clear
borderColor = .separator
}
cell.categoryView.backgroundColor = backgroundColor
cell.categoryView.titleLabel.textColor = textColor
cell.categoryView.layer.borderColor = borderColor.cgColor
}
.store(in: &cell.observations)

View File

@ -16,7 +16,7 @@ class PickServerCategoryView: UIView {
let titleLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center
label.font = .systemFont(ofSize: 15, weight: .semibold)
label.font = .systemFont(ofSize: 15, weight: .regular)
label.textColor = Asset.Colors.Label.secondary.color
return label
}()