feat(main-home): 추천 홈 공용 컴포넌트를 추가한다
This commit is contained in:
66
SodaLive/Sources/V2/Component/Card/AiCharacterCard.swift
Normal file
66
SodaLive/Sources/V2/Component/Card/AiCharacterCard.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AiCharacterCard: View {
|
||||
let name: String
|
||||
let description: String
|
||||
let profileImageUrl: String?
|
||||
let chatCount: Int?
|
||||
let originalTitle: String?
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top, spacing: SodaSpacing.s12) {
|
||||
DownsampledKFImage(url: URL(string: profileImageUrl ?? ""), size: CGSize(width: 72, height: 72))
|
||||
.background(Color.gray800)
|
||||
.clipShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
||||
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s4) {
|
||||
Text(name)
|
||||
.appFont(.heading4)
|
||||
.foregroundColor(.white)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
|
||||
Text(description)
|
||||
.appFont(.body5)
|
||||
.foregroundColor(Color.gray500)
|
||||
.lineLimit(2)
|
||||
.truncationMode(.tail)
|
||||
|
||||
HStack(spacing: SodaSpacing.s8) {
|
||||
if let chatCount {
|
||||
Text("Chat \(chatCount)")
|
||||
.appFont(.caption2)
|
||||
.foregroundColor(Color.gray500)
|
||||
}
|
||||
|
||||
if let originalTitle, !originalTitle.isEmpty {
|
||||
Text(originalTitle)
|
||||
.appFont(.caption2)
|
||||
.foregroundColor(Color.gray500)
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
.padding(SodaSpacing.s12)
|
||||
.background(Color.gray900)
|
||||
.clipShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
||||
}
|
||||
}
|
||||
|
||||
struct AiCharacterCard_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AiCharacterCard(
|
||||
name: "AI 캐릭터",
|
||||
description: "캐릭터 설명이 표시됩니다.",
|
||||
profileImageUrl: nil,
|
||||
chatCount: 128,
|
||||
originalTitle: "원작"
|
||||
)
|
||||
.padding(SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user