Remove emoji-label (#540)
This commit is contained in:
parent
26d7287319
commit
83de4049d8
|
@ -21,7 +21,6 @@ extension CategoryPickerSection {
|
||||||
UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak dependency] collectionView, indexPath, item -> UICollectionViewCell? in
|
UICollectionViewDiffableDataSource(collectionView: collectionView) { [weak dependency] collectionView, indexPath, item -> UICollectionViewCell? in
|
||||||
guard let _ = dependency else { return nil }
|
guard let _ = dependency else { return nil }
|
||||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: PickServerCategoryCollectionViewCell.self), for: indexPath) as! PickServerCategoryCollectionViewCell
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: PickServerCategoryCollectionViewCell.self), for: indexPath) as! PickServerCategoryCollectionViewCell
|
||||||
cell.categoryView.emojiLabel.text = item.emoji
|
|
||||||
cell.categoryView.titleLabel.text = item.title
|
cell.categoryView.titleLabel.text = item.title
|
||||||
cell.observe(\.isSelected, options: [.initial, .new]) { cell, _ in
|
cell.observe(\.isSelected, options: [.initial, .new]) { cell, _ in
|
||||||
cell.categoryView.highlightedIndicatorView.alpha = cell.isSelected ? 1 : 0
|
cell.categoryView.highlightedIndicatorView.alpha = cell.isSelected ? 1 : 0
|
||||||
|
|
|
@ -19,14 +19,6 @@ class PickServerCategoryView: UIView {
|
||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
//TODO: @zeitschlag Remove emojiLabel
|
|
||||||
let emojiLabel: UILabel = {
|
|
||||||
let label = UILabel()
|
|
||||||
label.textAlignment = .center
|
|
||||||
label.font = .systemFont(ofSize: 34, weight: .regular)
|
|
||||||
return label
|
|
||||||
}()
|
|
||||||
|
|
||||||
let titleLabel: UILabel = {
|
let titleLabel: UILabel = {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.textAlignment = .center
|
label.textAlignment = .center
|
||||||
|
@ -51,6 +43,7 @@ extension PickServerCategoryView {
|
||||||
private func configure() {
|
private func configure() {
|
||||||
let container = UIStackView()
|
let container = UIStackView()
|
||||||
container.axis = .vertical
|
container.axis = .vertical
|
||||||
|
container.spacing = 2
|
||||||
container.distribution = .fillProportionally
|
container.distribution = .fillProportionally
|
||||||
|
|
||||||
container.translatesAutoresizingMaskIntoConstraints = false
|
container.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
@ -62,12 +55,11 @@ extension PickServerCategoryView {
|
||||||
container.bottomAnchor.constraint(equalTo: bottomAnchor),
|
container.bottomAnchor.constraint(equalTo: bottomAnchor),
|
||||||
])
|
])
|
||||||
|
|
||||||
container.addArrangedSubview(emojiLabel)
|
|
||||||
container.addArrangedSubview(titleLabel)
|
container.addArrangedSubview(titleLabel)
|
||||||
highlightedIndicatorView.translatesAutoresizingMaskIntoConstraints = false
|
highlightedIndicatorView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
container.addArrangedSubview(highlightedIndicatorView)
|
container.addArrangedSubview(highlightedIndicatorView)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
highlightedIndicatorView.heightAnchor.constraint(equalToConstant: 3).priority(.required - 1),
|
highlightedIndicatorView.heightAnchor.constraint(equalToConstant: 3)//.priority(.required - 1),
|
||||||
])
|
])
|
||||||
titleLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
titleLabel.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ protocol PickServerServerSectionTableHeaderViewDelegate: AnyObject {
|
||||||
|
|
||||||
final class PickServerServerSectionTableHeaderView: UIView {
|
final class PickServerServerSectionTableHeaderView: UIView {
|
||||||
|
|
||||||
static let collectionViewHeight: CGFloat = 88
|
static let collectionViewHeight: CGFloat = 30
|
||||||
static let searchTextFieldHeight: CGFloat = 38
|
static let searchTextFieldHeight: CGFloat = 38
|
||||||
static let spacing: CGFloat = 11
|
static let spacing: CGFloat = 11
|
||||||
|
|
||||||
|
@ -177,7 +177,6 @@ extension PickServerServerSectionTableHeaderView {
|
||||||
extension PickServerServerSectionTableHeaderView: UICollectionViewDelegate {
|
extension PickServerServerSectionTableHeaderView: UICollectionViewDelegate {
|
||||||
|
|
||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: indexPath: %s", ((#file as NSString).lastPathComponent), #line, #function, indexPath.debugDescription)
|
|
||||||
collectionView.selectItem(at: indexPath, animated: true, scrollPosition: .centeredHorizontally)
|
collectionView.selectItem(at: indexPath, animated: true, scrollPosition: .centeredHorizontally)
|
||||||
delegate?.pickServerServerSectionTableHeaderView(self, collectionView: collectionView, didSelectItemAt: indexPath)
|
delegate?.pickServerServerSectionTableHeaderView(self, collectionView: collectionView, didSelectItemAt: indexPath)
|
||||||
}
|
}
|
||||||
|
@ -205,5 +204,5 @@ extension PickServerServerSectionTableHeaderView: UITextFieldDelegate {
|
||||||
textField.resignFirstResponder()
|
textField.resignFirstResponder()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue