Skip to content

Commit

Permalink
💄 :: [#94] ViolationHistoryFeature / 규정 위반 내역 Modal UI
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Jul 25, 2023
1 parent 9f503e5 commit a2a4d81
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ open class BaseModalViewController: BaseViewController {
// MARK: - Properties

public var contentView = UIView()
.set(\.backgroundColor, .dotori(.background(.card)))
.set(\.cornerRadius, 16)
.set(\.alpha, 0)

// MARK: - LifeCycle

open override func viewDidLoad() {
super.viewDidLoad()
if UITraitCollection.current.userInterfaceStyle == .light {
view.backgroundColor = .init(red: 0.02, green: 0.03, blue: 0.17, alpha: 0.45)
} else {
view.backgroundColor = .init(red: 0, green: 0, blue: 0, alpha: 0.45)
}
super.viewDidLoad()
}


open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
modalAnimation()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
import BaseFeature
import Combine
import DesignSystem
import Foundation
import Localization
import MSGLayout
import UIKit
import UIKitUtil

final class MyViolationHistoryViewController: BaseViewController<MyViolationHistoryStore> {

final class MyViolationHistoryViewController: BaseStoredModalViewController<MyViolationHistoryStore> {
private enum Metric {
static let padding: CGFloat = 24
}
private let violationHistoryTitleLabel = DotoriLabel(L10n.ViolationHistory.violationTitle)
private let xmarkButton = DotoriIconButton(image: .Dotori.xmark)
private let violationHistoryTableView = UITableView()
.set(\.backgroundColor, .clear)
.set(\.separatorStyle, .none)
.set(\.sectionHeaderHeight, 0)
.set(\.sectionFooterHeight, 0)
.then {
$0.register(cellType: ViolationCell.self)
}
private lazy var violationHistoryTableAdapter = TableViewAdapter<GenericSectionModel<Void>>(
tableView: violationHistoryTableView
) { tableView, indexPath, item in
let cell: ViolationCell = tableView.dequeueReusableCell(for: indexPath)
cell.adapt(model: item)
return cell
}
private let confirmButton = DotoriButton(text: L10n.Global.confirmButtonTitle)

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
override func setLayout() {
MSGLayout.buildLayout {
contentView.layout
.center(.toSuperview())
.horizontal(.toSuperview(), .equal(20))
}

MSGLayout.stackedLayout(self.contentView) {
VStackView(spacing: 20) {
HStackView {
violationHistoryTitleLabel

xmarkButton
}

violationHistoryTableView
.height(200)

confirmButton
}
.margin(.all(Metric.padding))
}
.distribution(.fill)
}

override func bindState() {
Just([(), ()])
.map { [GenericSectionModel(items: $0)] }
.sink(receiveValue: violationHistoryTableAdapter.updateSections(sections:))
.store(in: &subscription)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import BaseFeature
import DesignSystem
import MSGLayout
import UIKit

final class ViolationCell: BaseTableViewCell<Void> {
private enum Metric {
static let padding: CGFloat = 16
}
private let containerView = UIView()
.set(\.backgroundColor, .dotori(.background(.bg)))
.set(\.cornerRadius, 8)
private let violationTitleLabel = DotoriLabel("타호실 출입", font: .body1)
private let dateLabel = DotoriLabel("2023.07.13", textColor: .neutral(.n20), font: .body2)

override func addView() {
contentView.addSubviews {
containerView
}
}

override func setLayout() {
MSGLayout.buildLayout {
containerView.layout
.vertical(.toSuperview(), .equal(5))
.horizontal(.toSuperview())
}
MSGLayout.stackedLayout(self.containerView) {
HStackView {
violationTitleLabel

SpacerView()

dateLabel
}
.margin(.all(Metric.padding))
.alignment(.center)
}
}

override func configureView() {
self.selectionStyle = .none
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ final class SelfStudyViewController: BaseStoredViewController<SelfStudyStore> {
private let selfStudyTableView = UITableView()
.set(\.backgroundColor, .clear)
.set(\.separatorStyle, .none)
.set(\.sectionHeaderHeight, 0)
.set(\.sectionFooterHeight, 0)
.set(\.isHidden, true)
.then {
$0.register(cellType: SelfStudyCell.self)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
ViolationHistory.strings
Localization

Created by 최형우 on 2023/07/25.
Copyright © 2023 com.msg. All rights reserved.
*/

"violation_title" = "Vioalation History";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
ViolationHistory.strings
Localization

Created by 최형우 on 2023/07/25.
Copyright © 2023 com.msg. All rights reserved.
*/

"violation_title" = "규정 위반 내역";

0 comments on commit a2a4d81

Please sign in to comment.