Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ [CHORE] 나도선배 Style NaviBar 공통 컴포넌트 - 커뮤니티 2줄 NaviBar Style을 추가합니다. #405

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum NaviState {
case backDefaultWithNadoBtn
case backDefaultWithCustomRightBtn
case backWithCenterTitle
case backWithTwoLineTitle
case dismissWithCustomRightBtn
case dismissWithNadoBtn
}
Expand All @@ -24,6 +25,7 @@ enum NaviState {
- backDefault: 뒤로가기 버튼 + 바로 옆 텍스트 (디폴트)
- backDefaultWithNadoBtn: 뒤로가기 버튼과 + 바로 옆 텍스트 + 우측 나도선배 버튼
- backWithCenterTitle: 뒤로가기 버튼 + 중앙 텍스트 + 우측 버튼
- backWithTwoLineTitle: 뒤로가기 버튼 + 중앙 2줄 텍스트 + 우측 버튼
- dismissWithCustomRightBtn: 취소 버튼과 중앙 텍스트 + 우측 버튼
- dismissWithNadoBtn: 취소 버튼과 중앙 텍스트 + 우측 나도선배 버튼

Expand All @@ -42,6 +44,10 @@ class NadoSunbaeNaviBar: UIView {
$0.setLabel(text: "제목", color: .black, size: 20, weight: .medium)
}

private (set) lazy var subTitleLabel = UILabel().then {
$0.setLabel(text: "제목", color: .gray3, size: 12, weight: .regular)
}

private (set) lazy var backBtn = UIButton().then {
$0.setImgByName(name: "btnBack", selectedName: nil)
$0.contentMode = .scaleAspectFit
Expand Down Expand Up @@ -174,6 +180,39 @@ extension NadoSunbaeNaviBar {
titleLabel.setLabel(text: "제목", color: .black, size: 16, weight: .medium)
}

/// 뒤로가기 버튼 + 중앙 2줄 텍스트 + 우측 커스텀 버튼 UI를 구성하는 메서드
private func configureBackWithTwoLineTitleUI() {
self.addSubviews([backView, backBtn, titleLabel, subTitleLabel, rightCustomBtn])
backView.snp.makeConstraints {
$0.top.leading.trailing.bottom.equalToSuperview()
}

backBtn.snp.makeConstraints {
$0.bottom.equalToSuperview().offset(-12)
$0.leading.equalToSuperview()
$0.height.width.equalTo(48)
}

titleLabel.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.centerY.equalTo(backBtn)
}

subTitleLabel.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom)
$0.centerX.equalToSuperview()
}

rightCustomBtn.snp.makeConstraints {
$0.trailing.equalTo(self.snp.trailing).offset(-8)
$0.height.equalTo(44)
$0.centerY.equalTo(backBtn)
}

titleLabel.setLabel(text: "제목", color: .black, size: 16, weight: .medium)
subTitleLabel.setLabel(text: "제목", color: .gray3, size: 12, weight: .regular)
}

/// 취소 버튼 + 중앙 텍스트 + 우측 커스텀 버튼 UI를 구성하는 메서드
private func configureDismissWithCustomRightBtnUI() {
self.addSubviews([backView, dismissBtn, titleLabel, rightCustomBtn])
Expand Down Expand Up @@ -252,6 +291,8 @@ extension NadoSunbaeNaviBar {
configureBackWithNadoBtnUI()
case .backWithCenterTitle:
configureBackWithCenterUI()
case .backWithTwoLineTitle:
configureBackWithTwoLineTitleUI()
case .backDefaultWithCustomRightBtn:
configureBackWithCustomRightBtn()
case .dismissWithCustomRightBtn:
Expand Down