Skip to content

Commit

Permalink
fix: changed pts, event type cell color & placement
Browse files Browse the repository at this point in the history
  • Loading branch information
louisunlimited committed Jan 16, 2023
1 parent 3c7b2c2 commit 033ef19
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions HackIllinois/UI/HILabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class HILabel: UILabel {
font = HIAppearance.Font.eventTime

case .eventType:
textHIColor = \.baseText
textHIColor = \.whiteText
backgroundHIColor = \.clear
font = HIAppearance.Font.eventCategoryText
font = HIAppearance.Font.eventButtonText

case .sponsor:
textHIColor = \.baseText
Expand Down Expand Up @@ -215,7 +215,7 @@ class HILabel: UILabel {
font = HIAppearance.Font.countdownText

case .pointsText:
textHIColor = \.baseText
textHIColor = \.whiteText
backgroundHIColor = \.clear
font = HIAppearance.Font.eventButtonText
textAlignment = .center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ extension HIEventCell {
timeLabel.heightAnchor.constraint(equalTo: upperContainerView.heightAnchor, constant: 7).isActive = true
let pointsView = HIView { (view) in
view.layer.cornerRadius = 12
view.backgroundHIColor = \.buttonGreen
view.backgroundHIColor = \.buttonMagenta
view.translatesAutoresizingMaskIntoConstraints = false
}

Expand Down
21 changes: 14 additions & 7 deletions HackIllinois/ViewControllers/HIEventDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class HIEventDetailViewController: HIBaseViewController {
}
private let titleLabel = HILabel(style: .detailTitle)

private let eventTypeView = HIView { (view) in
view.layer.cornerRadius = 8
view.backgroundHIColor = \.buttonDarkBlueGreen
view.translatesAutoresizingMaskIntoConstraints = false
}
private let eventTypeLabel = HILabel(style: .eventType)

private let sponsorLabel = HILabel(style: .sponsor)
Expand All @@ -47,7 +52,7 @@ class HIEventDetailViewController: HIBaseViewController {
private let descriptionLabel = HILabel(style: .detailText)
let pointsView = HIView { (view) in
view.layer.cornerRadius = 8
view.backgroundHIColor = \.buttonGreen
view.backgroundHIColor = \.buttonMagenta
view.translatesAutoresizingMaskIntoConstraints = false
}
private let pointsLabel = HILabel(style: .pointsText)
Expand Down Expand Up @@ -148,7 +153,7 @@ extension HIEventDetailViewController {
}
favoritedButton.isActive = event.favorite
pointsLabel.text = "+ \(event.points) pts "
eventTypeLabel.text = event.eventType.lowercased().capitalized
eventTypeLabel.text = " \(event.eventType.lowercased().capitalized) "
view.layoutIfNeeded()
let targetSize = CGSize(width: descriptionLabel.frame.width, height: .greatestFiniteMagnitude)
let neededSize = descriptionLabel.sizeThatFits(targetSize)
Expand Down Expand Up @@ -187,9 +192,11 @@ extension HIEventDetailViewController {
upperContainerView.constrain(height: 95)
}
func setupEventType() {
upperContainerView.addSubview(eventTypeLabel)
eventTypeLabel.leadingAnchor.constraint(equalTo: titleLabel.leadingAnchor).isActive = true
eventTypeLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 5).isActive = true
upperContainerView.addSubview(eventTypeView)
eventTypeView.leadingAnchor.constraint(equalTo: titleLabel.leadingAnchor).isActive = true
eventTypeView.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 10).isActive = true
eventTypeView.addSubview(eventTypeLabel)
eventTypeLabel.constrain(to: eventTypeView, topInset: 0, trailingInset: 0, bottomInset: 0, leadingInset: 0)
}
func setupSponsor() {
upperContainerView.addSubview(sponsorLabel)
Expand All @@ -214,8 +221,8 @@ extension HIEventDetailViewController {
}
func setupPoints() {
upperContainerView.addSubview(pointsView)
pointsView.centerYAnchor.constraint(equalTo: timeImageView.centerYAnchor).isActive = true
pointsView.leadingAnchor.constraint(equalTo: timeLabel.trailingAnchor, constant: 10).isActive = true
pointsView.centerYAnchor.constraint(equalTo: eventTypeView.centerYAnchor).isActive = true
pointsView.leadingAnchor.constraint(equalTo: eventTypeView.trailingAnchor, constant: 10).isActive = true
pointsView.addSubview(pointsLabel)
pointsLabel.constrain(to: pointsView, topInset: 0, trailingInset: 0, bottomInset: 0, leadingInset: 0)
}
Expand Down

0 comments on commit 033ef19

Please sign in to comment.