-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge :: NoticeDetail UI #118
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
603fa0f
feat :: 공지 상세보기 UI 구현
sian7563 11c9e5d
feat : NoticeListComponent에 DetailComponent 추가
sian7563 e7064e1
feat :: NoticeListView navigation 코드 추가
sian7563 016c74d
feat :: NoticeDetailViewModel 구현
sian7563 77c7ba4
feat :: 공지 상세 UI 구현
sian7563 5b77f26
feat :: NoticeDetailComponent 구현
sian7563 7ba3d6a
feat :: AppComponent에 NoticeDetailComponent 추가
sian7563 dd6d4a6
feat :: NeedleGenerated
sian7563 407c62b
feat :: NoticeDetailViewModel 피드백 수정 date 추가
sian7563 d881322
feat :: stack밖 필요없는 Spacer 삭제
sian7563 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
18 changes: 18 additions & 0 deletions
18
Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailComponent.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,18 @@ | ||
import DomainModule | ||
import NeedleFoundation | ||
import SwiftUI | ||
|
||
public protocol NoticeDetailDependency: Dependency { | ||
var fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase { get } | ||
} | ||
|
||
public final class NoticeDetailComponent: Component<NoticeDetailDependency> { | ||
public func makeView(id: String) -> some View { | ||
NoticeDetailView( | ||
viewModel: .init( | ||
fetchDetailNoticeUseCase: self.dependency.fetchDetailNoticeUseCase, | ||
id: id | ||
) | ||
) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailView.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,40 @@ | ||
import DesignSystem | ||
import SwiftUI | ||
import Utility | ||
|
||
struct NoticeDetailView: View { | ||
@StateObject var viewModel: NoticeDetailViewModel | ||
@Environment(\.dismiss) var dismiss | ||
|
||
var body: some View { | ||
VStack { | ||
VStack(alignment: .leading, spacing: 24) { | ||
Text(viewModel.title) | ||
.dmsFont(.title(.small), color: .GrayScale.gray7) | ||
.padding(.top, 40) | ||
|
||
Divider() | ||
} | ||
VStack(alignment: .leading, spacing: 24) { | ||
Text(viewModel.content) | ||
.padding(.top, 24) | ||
.padding(.bottom, 40) | ||
|
||
HStack { | ||
Spacer() | ||
|
||
Text(viewModel.date.toDMSDateString()) | ||
.dmsFont(.text(.extraSmall), color: .GrayScale.gray5) | ||
.frame(alignment: .trailing) | ||
} | ||
} | ||
|
||
Spacer() | ||
} | ||
.navigationTitle("공지") | ||
.navigationBarTitleDisplayMode(.inline) | ||
.padding(.horizontal, 24) | ||
|
||
Spacer() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Projects/Features/NoticeFeature/Sources/Detail/NoticeDetailViewModel.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,30 @@ | ||
import BaseFeature | ||
import UIKit | ||
import Combine | ||
import DomainModule | ||
|
||
final class NoticeDetailViewModel: BaseViewModel { | ||
@Published var title = "" | ||
@Published var content = "" | ||
@Published var date = Date() | ||
|
||
let id: String | ||
|
||
private let fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase | ||
|
||
init( | ||
fetchDetailNoticeUseCase: any FetchDetailNoticeUseCase, | ||
id: String | ||
) { | ||
self.fetchDetailNoticeUseCase = fetchDetailNoticeUseCase | ||
self.id = id | ||
super.init() | ||
|
||
addCancellable( | ||
fetchDetailNoticeUseCase.execute(id: id) | ||
) { [weak self] noticeDetail in | ||
self?.title = noticeDetail.title | ||
self?.content = noticeDetail.content | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. date에 createdAt! |
||
} | ||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stack 밖에 Spacer가 있어요!