콘텐츠 상세

- 댓글이 없을 때 유료 콘텐츠를 구매한 사람이 비밀댓글을 등록할 수 있는 기능 추가
This commit is contained in:
Yu Sung
2024-08-30 17:15:13 +09:00
parent ca9dee5574
commit fa849dd5b6
5 changed files with 33 additions and 14 deletions

View File

@@ -12,10 +12,12 @@ struct ContentDetailCommentView: View {
let commentCount: Int
let commentList: [GetAudioContentCommentListItem]
let isShowSecret: Bool
let registerComment: (String) -> Void
let registerComment: (String, Bool) -> Void
@State private var comment = ""
@State private var isSecret = false
var body: some View {
VStack(alignment: .leading, spacing: 10.3) {
@@ -26,9 +28,24 @@ struct ContentDetailCommentView: View {
Text("\(commentCount)")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "909090"))
.foregroundColor(Color.gray90)
Spacer()
if isShowSecret && commentCount <= 0 {
HStack(spacing: 8) {
Image(isSecret ? "btn_select_checked" : "btn_select_normal")
.resizable()
.frame(width: 20, height: 20)
Text("비밀댓글")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color.grayee)
}
.onTapGesture {
isSecret.toggle()
}
}
}
HStack(spacing: 8) {
@@ -48,7 +65,7 @@ struct ContentDetailCommentView: View {
if commentCount > 0 {
Text(commentList[0].comment)
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "bbbbbb"))
.foregroundColor(Color.graybb)
.lineLimit(1)
.lineSpacing(8)
.padding(.leading, 3)
@@ -58,8 +75,8 @@ struct ContentDetailCommentView: View {
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.accentColor(Color(hex: "3bb9f1"))
.foregroundColor(Color.grayee)
.accentColor(Color.button)
.keyboardType(.default)
.padding(.horizontal, 13.3)
@@ -71,15 +88,15 @@ struct ContentDetailCommentView: View {
.padding(6.7)
.onTapGesture {
hideKeyboard()
registerComment(comment)
registerComment(comment, isSecret)
}
}
.background(Color(hex: "232323"))
.background(Color.gray23)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "3bb9f1"))
.foregroundColor(Color.button)
)
}