-
Notifications
You must be signed in to change notification settings - Fork 1
오늘의 질문 UI 업데이트 #359
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
오늘의 질문 UI 업데이트 #359
Conversation
| var isNewQuestion = false | ||
| @Presents var sheet: Sheet.State? | ||
| @Presents var alert: AlertState<Action.Alert>? | ||
| @Shared(.appStorage(Constant.recentQuestionID)) var recentQuestionID = 0 |
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.
isNewQuestion: 새로운 질문이 등록되었는지 여부를 확인
recentQuestionID: 가장 최근에 등록됐었던 질문의 ID
recentQuestionID의 경우 AppStorge에 저장함으로써 N번째 진입 시 SmallHeaderView를 보여줄 수 있도록 구현했습니다.
| if mainQuestion.id != state.recentQuestionID { | ||
| state.isNewQuestion = true | ||
| state.$recentQuestionID.withLock { $0 = mainQuestion.id } | ||
| } else { | ||
| state.isNewQuestion = false | ||
| } |
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.
메인 질문을 받아올 때 저장되어있던 Question ID값과 비교 후 새롭게 등록된 질문인지 판단 + 업데이트합니다.
| ScrollView { | ||
| VStack(spacing: 0) { | ||
| if store.isNewQuestion { | ||
| LargeHeaderView(store: store) | ||
| LargeQuestionButton(store: store) | ||
| } else { | ||
| SmallHeaderView(store: store) | ||
| } | ||
| AnswerPreviewList(store: store) | ||
| } |
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.
새롭게 등록됐으면 LargeHeader, 이미 봤던 질문이라면 SmallHeader
| private func Footer() -> some View { | ||
| HStack(spacing: 0) { | ||
| Circle() | ||
| .foregroundStyle(.clear) | ||
| .frame(width: 28, height: 28) | ||
|
|
||
| Button { | ||
| likeAction() | ||
| } label: { | ||
| HStack(spacing: 4) { | ||
| Image(true ? .heartActive : .heart) | ||
| .resizable() | ||
| .frame(width: 18, height: 18) | ||
|
|
||
| Text("32") | ||
| .pretendard(.regular, 13) | ||
| .foregroundStyle(.sub3) | ||
| } | ||
| } | ||
| .padding(.leading, 8) | ||
|
|
||
| Button { | ||
| commentAction() | ||
| } label: { | ||
| HStack(spacing: 4) { | ||
| Image(systemName: "text.bubble.fill") | ||
| .resizable() | ||
| .frame(width: 15, height: 14) | ||
|
|
||
| Text("32") | ||
| .pretendard(.regular, 13) | ||
| } | ||
| .foregroundStyle(.sub3) | ||
| } | ||
| .padding(.leading, 12) | ||
| } | ||
| } |
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.
QPAnswerCell UI 컴포넌트 내부에 좋아요, 댓글 버튼 등록해뒀습니다! 게시글 Cell과 동일해욧
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.
++ 답변 셀도 크기가 조금 더 커졌습니다! 게시글 Cell 작업하실 때도 체크 부탁드립니다!
mooninbeom
left a comment
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.
한번 봤던 질문은 작아지는게 참 기가막히군요 호호
LGTM
OhMyungJin
left a comment
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.
cell크기 확인했습니다~! LGTM
close #358
TO-DO
스크린샷