Files
sodalive-ios/SodaLive/Sources/Chat/Character/Recent/RecentCharacterSectionView.swift
Yu Sung 866b65d0ed 캐릭터 탭 - 섹션 사이 간격 48
채팅 캐릭터 이미지 비율 2:3으로 변경
채팅 배경 사진 -> 채팅 배경 이미지로 단어 변경
2025-09-05 14:11:27 +09:00

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("최근 대화한 캐릭터 ")
.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)
}