Files
GitHawk/Classes/Issues/Referenced/IssueReferencedCell.swift
Ryan Nystrom e56c29a9a6 Redesigned Issues interface (#1983)
* clean up title model

* update title style

* organize issue SC method

* remove background colors from styled text in issues

* collection view bg white

* remove card inset and clean up snap superview code

* clean up label design

* thread is root and change base font size

* remove borders on comment cells

* adjust collapse design

* adjust comment line spacing and make non-root body smaller

* refactor detail view

* viewer header background color

* more buttons in reaction cell

* vertical spacers working

* design basically finished;

* scroll to bottom accounts for inset

* PR review background color white

* fixup PR review comments

* spacing on merge and review

* readme background white

* rename to just "spacer"

* horizontal spacing

* fix tests
2018-07-27 11:03:09 -04:00

55 lines
1.4 KiB
Swift

//
// IssueReferencedCell.swift
// Freetime
//
// Created by Ryan Nystrom on 7/9/17.
// Copyright © 2017 Ryan Nystrom. All rights reserved.
//
import UIKit
import SnapKit
final class IssueReferencedCell: StyledTextViewCell {
static let inset = UIEdgeInsets(
top: Styles.Sizes.inlineSpacing,
left: 0,
bottom: Styles.Sizes.inlineSpacing,
right: Styles.Sizes.icon.width + Styles.Sizes.rowSpacing
)
let statusButton = UIButton()
override init(frame: CGRect) {
super.init(frame: frame)
statusButton.setupAsLabel(icon: false)
statusButton.isUserInteractionEnabled = false
contentView.addSubview(statusButton)
statusButton.snp.makeConstraints { make in
make.right.equalToSuperview()
make.size.equalTo(Styles.Sizes.icon)
make.centerY.equalToSuperview()
}
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: Public API
func configure(_ model: IssueReferencedModel) {
set(renderer: model.string)
let buttonState: UIButton.State
switch model.state {
case .closed: buttonState = .closed
case .merged: buttonState = .merged
case .open: buttonState = .open
}
statusButton.config(pullRequest: model.pullRequest, state: buttonState)
}
}