Skip to content

Commit

Permalink
[ITDS-75] feat: #61 - FAB 영역 내 "추천 공고 관리" 버튼 UI 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wongbingg committed Feb 9, 2025
1 parent 0dbc298 commit 0f8c9a4
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "pin2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 55 additions & 11 deletions Targets/DesignSystem/Sources/Component/Home/FABSubButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,57 @@

import UIKit

import RxSwift

public final class FABSubButton: UIView {
// MARK: Properties
public var registPostButtonObservable: Observable<Void> {
registPostButton.rx.tap.asObservable()
}

public var recommendPostButtonObservable: Observable<Void> {
recommendPostButton.rx.tap.asObservable()
}

// MARK: UI
private let rootFlexContainer = UIView()

private let icon: UIImageView = {
private let registPostButton = UIButton()

private let registPostIcon: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.image = DesignSystemAsset.registerPost.image
return imageView
}()

private let registPostTitle = MozipLabel(
style: .heading3,
color: MozipColor.primary700,
text: "공고 등록"
)

private let recommendPostButton = UIButton()

private let recommendPostIcon: UIImageView = {
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
imageView.image = DesignSystemAsset.pin2.image
return imageView
}()

private let title = MozipLabel(
private let recommendPostTitle = MozipLabel(
style: .heading3,
color: MozipColor.primary700
color: MozipColor.primary700,
text: "추천 공고 관리"
)

public init(iconImage: UIImage, title: String) {
public init() {
super.init(frame: .zero)
setupViewHierarchy()
setupViewLayout()
self.backgroundColor = .white
self.layer.cornerRadius = 8
self.icon.image = iconImage
self.title.updateTextKeepingAttributes(title)
}

required init?(coder: NSCoder) {
Expand All @@ -47,17 +76,32 @@ private extension FABSubButton {
func setupViewHierarchy() {
addSubview(rootFlexContainer)
rootFlexContainer.flex
.direction(.row)
.alignItems(.center)
.direction(.column)
.alignItems(.start)
.define { flex in
flex.addItem(icon).size(24).marginLeft(16)
flex.addItem(title).marginLeft(8)
flex.addItem(registPostButton)
.direction(.row)
.alignItems(.center)
.marginTop(20)
.define { flex in
flex.addItem(registPostIcon).size(24).marginLeft(16)
flex.addItem(registPostTitle).marginLeft(8)
}

flex.addItem(recommendPostButton)
.direction(.row)
.alignItems(.center)
.marginTop(20)
.define { flex in
flex.addItem(recommendPostIcon).size(24).marginLeft(16)
flex.addItem(recommendPostTitle).marginLeft(8)
}
}
}

func setupViewLayout() {
rootFlexContainer.pin.all()
rootFlexContainer.flex.layout()
pin.size(CGSize(width: 163, height: 64))
pin.size(CGSize(width: 163, height: 108))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public protocol HomeCoordinatorType: CoordinatorType {
func pushMyPage()
func pushPostDetail(id: Int)
func pushPostRegister()
func pushPostRecommend()
}

final class HomeCoordinator: HomeCoordinatorType {
Expand Down Expand Up @@ -95,6 +96,10 @@ final class HomeCoordinator: HomeCoordinatorType {
addChild(postUploadCoordinator)
postUploadCoordinator.start()
}

func pushPostRecommend() {
// TODO: PostRecommend 화면 생성 후 이동
}
}

// MARK: - Private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ final class HomeViewController: BaseViewController<HomeReactor>, Coordinatable {
private let bannerView = RecommendingBanner()
private let collectionView = PostCollectionView()
private let fabButton = FABButton()

private let fabSubButton = FABSubButton(
iconImage: DesignSystemAsset.registerPost.image,
title: "공고 등록"
)
private let fabSubButton = FABSubButton()

private let fabButtonDimmingView: UIView = {
let view = UIView()
Expand Down Expand Up @@ -230,14 +226,22 @@ private extension HomeViewController {
}
.disposed(by: disposeBag)

fabSubButton.rxGesture.tap
fabSubButton.registPostButtonObservable
.asSignal(onErrorSignalWith: .empty())
.emit(with: self) { owner, _ in
owner.fabButton.isExpanded.accept(false)
owner.coordinator?.pushPostRegister()
}
.disposed(by: disposeBag)

fabSubButton.recommendPostButtonObservable
.asSignal(onErrorSignalWith: .empty())
.emit(with: self) { owner, _ in
owner.fabButton.isExpanded.accept(false)
owner.coordinator?.pushPostRecommend()
}
.disposed(by: disposeBag)

fabButtonDimmingView.rxGesture.tap
.asSignal(onErrorSignalWith: .empty())
.map { _ in false }
Expand Down

0 comments on commit 0f8c9a4

Please sign in to comment.