Files
sodalive-ios/SodaLive/Sources/Chat/Character/Recent/RecentCharacterSectionView.swift

56 lines
1.7 KiB
Swift

//
// RecentCharacterSectionView.swift
// SodaLive
//
// Created by klaus on 8/29/25.
//
import SwiftUI
struct RecentCharacterSectionView: View {
let titleCount: Int
let items: [RecentCharacter]
var onTap: (RecentCharacter) -> Void = { _ in }
var body: some View {
VStack(alignment: .leading, spacing: 16) {
HStack(spacing: 0) {
Text("최근 대화한 캐릭터 ")
.appFont(size: 20, weight: .bold)
.foregroundColor(.white)
Text("\(titleCount)")
.appFont(size: 20, weight: .bold)
.foregroundColor(Color(hex: "FDCA2F"))
Spacer()
}
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 16) {
ForEach(items.indices, id: \.self) { idx in
let item = items[idx]
RecentCharacterItemView(character: item)
.onTapGesture { onTap(item) }
}
}
.padding(.horizontal, 24)
}
}
}
}
#Preview {
RecentCharacterSectionView(
titleCount: 3,
items: [
RecentCharacter(characterId: 1, name: "라라", imageUrl: "https://picsum.photos/200"),
RecentCharacter(characterId: 2, name: "마리", imageUrl: "https://picsum.photos/200"),
RecentCharacter(characterId: 3, name: "Nana", imageUrl: "https://picsum.photos/200")
]
)
.padding()
.background(Color.black)
}