Files
sodalive-ios/SodaLive/Sources/Live/Room/V2/Component/View/LiveRoomInfoCreatorView.swift

86 lines
2.6 KiB
Swift

//
// LiveRoomInfoCreatorView.swift
// SodaLive
//
// Created by klaus on 2024/01/17.
//
import SwiftUI
import Kingfisher
struct LiveRoomInfoCreatorView: View {
let roomTitle: String
let creatorNickname: String
let creatorProfileUrl: String
let isMute: Bool
let isAdult: Bool
let isActiveSpeaker: Bool
let onClickProfile: () -> Void
var body: some View {
HStack(spacing: 5.3) {
ZStack(alignment: .center) {
KFImage(URL(string: creatorProfileUrl))
.cancelOnDisappear(true)
.downsampling(
size: CGSize(
width: 33.3,
height: 33.3
)
)
.resizable()
.frame(width: 33.3, height: 33.3)
.clipShape(Circle())
.overlay(
Circle()
.stroke(
Color.button,
lineWidth: isActiveSpeaker ? 3 : 0
)
)
.onTapGesture { onClickProfile() }
if isMute {
Image("ic_mute")
.resizable()
.frame(width: 33.3, height: 33.3)
}
}
VStack(alignment: .leading, spacing: 6.7) {
Text(isAdult ? "🔞 \(roomTitle)" : roomTitle)
.appFont(size: 12, weight: .bold)
.foregroundColor(.grayee)
.lineLimit(1)
Text(creatorNickname)
.appFont(size: 12, weight: .medium)
.foregroundColor(.gray77)
.lineLimit(1)
}
}
.padding(8)
.frame(width: screenSize().width / 2.5, alignment: .leading)
.overlay(
RoundedRectangle(cornerRadius: 5.3)
.stroke(Color.graybb, lineWidth: 1)
)
}
}
struct LiveRoomInfoCreatorView_Previews: PreviewProvider {
static var previews: some View {
LiveRoomInfoCreatorView(
roomTitle: "qwer",
creatorNickname: "도화",
creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320",
isMute: false,
isAdult: false,
isActiveSpeaker: true,
onClickProfile: {}
)
}
}