Files
sodalive-ios/SodaLive/Sources/Chat/Character/Recent/RecentCharacterSectionView.swift
Yu Sung 7b3bb79e2c fix(character): 최근 대화한 캐릭터
- 좌/우 padding 24 추가
2025-09-02 03:51:28 +09:00

54 lines
1.6 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: 12) {
HStack(spacing: 0) {
Text("최근 대화한 캐릭터 ")
.font(.custom(Font.preBold.rawValue, size: 20))
.foregroundColor(.white)
Text("\(titleCount)")
.font(.custom(Font.preBold.rawValue, size: 20))
.foregroundColor(Color(hex: "FDCA2F"))
Spacer()
}
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(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)
}