feat(chat-original): 원작 상세 화면 및 캐릭터 무한 스크롤 로딩 구현
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// OriginalWorkDetailHeaderView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 9/16/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct OriginalWorkDetailHeaderView: View {
|
||||
|
||||
let item: OriginalWorkDetailResponse
|
||||
|
||||
@State var isDescriptionExpanded = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
if let imageUrl = item.imageUrl {
|
||||
KFImage(URL(string: imageUrl))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 168, height: 168 * 432 / 306)
|
||||
.clipped()
|
||||
.cornerRadius(16)
|
||||
}
|
||||
|
||||
Text(item.title)
|
||||
.font(.custom(Font.preBold.rawValue, size: 26))
|
||||
.foregroundColor(.white)
|
||||
.padding(.top, 40)
|
||||
|
||||
HStack(spacing: 4) {
|
||||
Text(item.contentType)
|
||||
.font(.custom(Font.preRegular.rawValue, size: 14))
|
||||
.foregroundColor(Color(hex: "B0BEC5"))
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 3)
|
||||
.background(Color(hex: "263238"))
|
||||
.cornerRadius(4)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.strokeBorder(lineWidth: 1)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
|
||||
Text(item.category)
|
||||
.font(.custom(Font.preRegular.rawValue, size: 14))
|
||||
.foregroundColor(.button)
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 3)
|
||||
.background(Color(hex: "263238"))
|
||||
.cornerRadius(4)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.strokeBorder(lineWidth: 1)
|
||||
.foregroundColor(.button)
|
||||
}
|
||||
|
||||
if item.isAdult {
|
||||
Text("19+")
|
||||
.font(.custom(Font.preRegular.rawValue, size: 14))
|
||||
.foregroundColor(Color(hex: "ff5c49"))
|
||||
.padding(.horizontal, 7)
|
||||
.padding(.vertical, 3)
|
||||
.background(Color(hex: "263238"))
|
||||
.cornerRadius(4)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.strokeBorder(lineWidth: 1)
|
||||
.foregroundColor(Color(hex: "ff5c49"))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.top, 14)
|
||||
|
||||
Text(item.description)
|
||||
.font(.custom(Font.preRegular.rawValue, size: 14))
|
||||
.foregroundColor(Color(hex: "cfd8dc"))
|
||||
.lineLimit(!isDescriptionExpanded ? 2 : Int.max)
|
||||
.truncationMode(.tail)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 14)
|
||||
.onTapGesture {
|
||||
isDescriptionExpanded.toggle()
|
||||
}
|
||||
|
||||
Text("원작 보러가기")
|
||||
.font(.custom(Font.preBold.rawValue, size: 16))
|
||||
.foregroundColor(.button)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 15)
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.strokeBorder(lineWidth: 1)
|
||||
.foregroundColor(.button)
|
||||
}
|
||||
.padding(.top, 24)
|
||||
.onTapGesture {
|
||||
if let link = item.originalLink, let url = URL(string: link) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
OriginalWorkDetailHeaderView(
|
||||
item: OriginalWorkDetailResponse(
|
||||
imageUrl: "https://picsum.photos/400",
|
||||
title: "작품제목",
|
||||
contentType: "웹소설",
|
||||
category: "로맨스",
|
||||
isAdult: true,
|
||||
description: "작품설명입니다.보이스온의 오픈월드 캐릭터톡은 청소년 보호를 위해 본인인증한성인만 이용이 가능합니다.캐릭터톡 서비스를 이용하시려면 본인인증을 하고 이용해주세요.",
|
||||
originalLink: "https://apple.com",
|
||||
characters: []
|
||||
)
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user