Skip to content

Commit

Permalink
refactor/#277 JoinButtonView 텍스트 설정 함수 대신 생성자로 초기화 가능하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Aug 8, 2024
1 parent 96815bc commit 994294c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ class CheckInviteCodeView: BaseView {


// MARK: Property

let enterInviteCodeView: JoinButtonView = JoinButtonView(
mainTitle: "초대 코드를 받았다면",
subTitle: "초대 코드가 없다면"
)

let createMeetingView: JoinButtonView = JoinButtonView(
mainTitle: "초대 코드 입력하기",
subTitle: "직접 모임 추가하기"
)

private let checkInviteLabel: UILabel = UILabel().then {
$0.setText("친구에게 받은\n모임 초대 코드가 있으신가요?", style: .head01, color: .gray8)
}

let enterInviteCodeView: JoinButtonView = JoinButtonView().then {
$0.setJoinButtonViewStatus(isReceived: true)
}

let createMeetingView: JoinButtonView = JoinButtonView().then {
$0.setJoinButtonViewStatus(isReceived: false)
}


// MARK: - Setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ class JoinButtonView: BaseView {


// MARK: - Setup


init(mainTitle: String, subTitle: String) {
super.init(frame: .zero)

mainTitleLabel.setText(mainTitle, style: .body03, color: .gray8)
subTitleLabel.setText(subTitle, style: .caption02, color: .gray5)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func setupView() {
self.backgroundColor = .green1

Expand Down Expand Up @@ -58,22 +69,3 @@ class JoinButtonView: BaseView {
}
}
}


// MARK: - Extension

extension JoinButtonView {
func setJoinButtonViewStatus(isReceived: Bool) {
subTitleLabel.setText(
isReceived ? "초대 코드를 받았다면" : "초대 코드가 없다면",
style: .caption02,
color: .gray5
)

mainTitleLabel.setText(
isReceived ? "초대 코드 입력하기" : "직접 모임 추가하기",
style: .body03,
color: .gray8
)
}
}

0 comments on commit 994294c

Please sign in to comment.