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

50 lines
1.4 KiB
Swift

//
// CharacterSectionView.swift
// SodaLive
//
// Created by klaus on 8/29/25.
//
import SwiftUI
struct CharacterSectionView: View {
let title: String
let items: [Character]
var onTap: (Character) -> Void = { _ in }
var body: some View {
VStack(alignment: .leading, spacing: 16) {
Text(title)
.font(.custom(Font.preBold.rawValue, size: 20))
.foregroundColor(.white)
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
ForEach(items.indices, id: \.self) { idx in
let item = items[idx]
CharacterItemView(
character: item,
size: screenSize().width * 0.42
)
.onTapGesture { onTap(item) }
}
}
.padding(.horizontal, 24)
}
}
}
}
#Preview {
CharacterSectionView(
title: "신규 캐릭터",
items: [
Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300"),
Character(characterId: 2, name: "데이지", description: "", imageUrl: "https://picsum.photos/300")
]
)
.padding()
.background(Color.black)
}