Skip to content

Commit

Permalink
feat(HomePresent): Expand touch target of navigation bar back button
Browse files Browse the repository at this point in the history
  • Loading branch information
dodo849 committed Jul 30, 2024
1 parent ed46ce8 commit b5d544b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public final class NofficeAnnouncementCard: UIView {
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
},
BaseHStack {[
BaseHStack(spacing: 0) {[
BaseSpacer(size: 16, orientation: .horizontal),
BaseVStack(spacing: 10) {[
BaseSpacer(size: 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import UIKit

import Assets

import RxSwift
import RxCocoa
import RxGesture
Expand Down Expand Up @@ -37,7 +39,14 @@ public final class NofficeNavigationBar: UIView {
// MARK: UI Constant
let height: CGFloat = 44

let backIconSize: CGFloat = 24

// MARK: UI Component
/// - Back icon (Back button)
private lazy var backIconBackground = UIView().then { // for touch target
$0.isUserInteractionEnabled = true
}

private lazy var backIcon = UIImageView(image: .iconChevronLeft).then {
$0.tintColor = .grey400
$0.contentMode = .scaleAspectFit
Expand Down Expand Up @@ -75,11 +84,11 @@ public final class NofficeNavigationBar: UIView {
setupBind()
}

// MARK: Public

// MARK: Setup
private func setupHierarchy() {
addSubview(backIcon)
addSubview(backIconBackground)

backIconBackground.addSubview(backIcon)

addSubview(titleLabel)

Expand All @@ -91,8 +100,17 @@ public final class NofficeNavigationBar: UIView {
$0.height.equalTo(height)
}

backIconBackground.snp.makeConstraints {
$0.left.equalToSuperview()
.inset(GlobalViewConstant.pagePadding)
$0.height.equalTo(backIconSize)
$0.width.equalTo(backIconSize * 2)
$0.centerY.equalToSuperview()
}

backIcon.snp.makeConstraints {
$0.left.equalToSuperview().inset(16)
$0.left.equalToSuperview()
$0.width.height.equalTo(backIconSize)
$0.centerY.equalToSuperview()
}

Expand All @@ -108,7 +126,7 @@ public final class NofficeNavigationBar: UIView {
}

private func setupBind() {
backIcon.rx.tapGesture()
backIconBackground.rx.tapGesture()
.when(.recognized)
.subscribe(onNext: { [weak self] _ in
self?._onTapBackButton.onNext(())
Expand Down

0 comments on commit b5d544b

Please sign in to comment.