generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄 :: [#94] ViolationHistoryFeature / 규정 위반 내역 Modal UI
- Loading branch information
Showing
6 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 64 additions & 2 deletions
66
...ts/Feature/MyViolationHistoryFeature/Sources/Scene/MyViolationHistoryViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Projects/Feature/MyViolationHistoryFeature/Sources/Scene/View/ViolationCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Projects/UserInterface/Localization/Resources/en.lproj/ViolationHistory.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
9 changes: 9 additions & 0 deletions
9
Projects/UserInterface/Localization/Resources/ko.lproj/ViolationHistory.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" = "규정 위반 내역"; |