Files
sodalive-ios/SodaLive/Sources/Home/HomeLiveItemView.swift
Yu Sung 87b43bd2c2 feat: 메인 홈 - 라이브 중
- 터치 액션 추가
2025-07-14 19:52:16 +09:00

96 lines
3.0 KiB
Swift

//
// HomeLiveItemView.swift
// SodaLive
//
// Created by klaus on 7/11/25.
//
import SwiftUI
import Kingfisher
struct HomeLiveItemView: View {
let item: GetRoomListResponse
let onClickItem: (Int) -> Void
var body: some View {
HStack(spacing: 16) {
ZStack(alignment: .bottom) {
ZStack {
KFImage(URL(string: item.creatorProfileImage))
.cancelOnDisappear(true)
.resizable()
.frame(width: 62, height: 62)
.clipShape(Circle())
}
.padding(7)
.overlay {
Circle()
.strokeBorder(lineWidth: 3)
.foregroundColor(.button)
}
Image("img_live")
}
VStack(alignment: .leading, spacing: 4) {
Text(item.title)
.font(.custom(Font.preRegular.rawValue, size: 18))
.foregroundColor(.white)
Text(item.creatorNickname)
.font(.custom(Font.preRegular.rawValue, size: 16))
.foregroundColor(Color(hex: "B0BEC5"))
}
}
.padding(.horizontal, 14)
.padding(.vertical, 10)
.frame(width: 282, alignment: .leading)
.background(
RadialGradient(
gradient: Gradient(colors: [Color(hex: "5ACDE1"), Color(hex: "2A339D")]),
center: .center,
startRadius: 0,
endRadius: 200
)
)
.cornerRadius(999)
.overlay(
RoundedRectangle(cornerRadius: 999)
.strokeBorder(
LinearGradient(
colors: [Color(hex: "9AE2F6"), Color(hex: "FFFFFF")],
startPoint: .topLeading,
endPoint: .bottomTrailing
),
lineWidth: 1
)
)
.contentShape(Rectangle())
.onTapGesture { onClickItem(item.roomId) }
}
}
#Preview {
HomeLiveItemView(
item: GetRoomListResponse(
roomId: 1,
title: "네네코 마사로",
content: "테스트",
beginDateTime: "2025-08-10 15:00:00",
numberOfParticipate: 1,
numberOfPeople: 10,
coverImageUrl: "https://cf.sodalive.net/live_room_cover/18038/18038-cover-8c3cb985-733d-4425-8eaf-ef753064d371-2283-1751800412922",
isAdult: false,
price: 0,
tags: [""],
channelName: "",
creatorProfileImage: "https://cf.sodalive.net/profile/34806/34806-profile-49db6b45-bb1e-4dc7-917e-1a614a853f5f-4232-1752158072656",
creatorNickname: "설린",
creatorId: 1,
isReservation: false,
isPrivateRoom: false
)
) { _ in }
}