diff --git a/Projects/Feature/BaseFeature/Sources/Base/BaseModalViewController.swift b/Projects/Feature/BaseFeature/Sources/Base/BaseModalViewController.swift index 0ff7bdee..513795aa 100644 --- a/Projects/Feature/BaseFeature/Sources/Base/BaseModalViewController.swift +++ b/Projects/Feature/BaseFeature/Sources/Base/BaseModalViewController.swift @@ -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() diff --git a/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/MyViolationHistoryViewController.swift b/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/MyViolationHistoryViewController.swift index 7f99fed7..f198b34e 100644 --- a/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/MyViolationHistoryViewController.swift +++ b/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/MyViolationHistoryViewController.swift @@ -1,5 +1,67 @@ import BaseFeature +import Combine +import DesignSystem +import Foundation +import Localization +import MSGLayout +import UIKit +import UIKitUtil -final class MyViolationHistoryViewController: BaseViewController { - +final class MyViolationHistoryViewController: BaseStoredModalViewController { + 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>( + 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) + } } diff --git a/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/View/ViolationCell.swift b/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/View/ViolationCell.swift new file mode 100644 index 00000000..ca6d846b --- /dev/null +++ b/Projects/Feature/MyViolationHistoryFeature/Sources/Scene/View/ViolationCell.swift @@ -0,0 +1,44 @@ +import BaseFeature +import DesignSystem +import MSGLayout +import UIKit + +final class ViolationCell: BaseTableViewCell { + 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 + } +} diff --git a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift index 9f458384..82faab52 100644 --- a/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift +++ b/Projects/Feature/SelfStudyFeature/Sources/Scene/SelfStudyViewController.swift @@ -20,6 +20,8 @@ final class SelfStudyViewController: BaseStoredViewController { 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) diff --git a/Projects/UserInterface/Localization/Resources/en.lproj/ViolationHistory.strings b/Projects/UserInterface/Localization/Resources/en.lproj/ViolationHistory.strings new file mode 100644 index 00000000..815e1278 --- /dev/null +++ b/Projects/UserInterface/Localization/Resources/en.lproj/ViolationHistory.strings @@ -0,0 +1,9 @@ +/* + ViolationHistory.strings + Localization + + Created by 최형우 on 2023/07/25. + Copyright © 2023 com.msg. All rights reserved. +*/ + +"violation_title" = "Vioalation History"; diff --git a/Projects/UserInterface/Localization/Resources/ko.lproj/ViolationHistory.strings b/Projects/UserInterface/Localization/Resources/ko.lproj/ViolationHistory.strings new file mode 100644 index 00000000..1cac814d --- /dev/null +++ b/Projects/UserInterface/Localization/Resources/ko.lproj/ViolationHistory.strings @@ -0,0 +1,9 @@ +/* + ViolationHistory.strings + Localization + + Created by 최형우 on 2023/07/25. + Copyright © 2023 com.msg. All rights reserved. +*/ + +"violation_title" = "규정 위반 내역";