104 lines
3.3 KiB
Swift
104 lines
3.3 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 isFollowing: Bool
|
|
let isActiveSpeaker: Bool
|
|
let isShowFollowingButton: Bool
|
|
|
|
let onClickFollow: () -> Void
|
|
let onClickProfile: () -> Void
|
|
|
|
var body: some View {
|
|
HStack(spacing: 5.3) {
|
|
ZStack(alignment: .center) {
|
|
KFImage(URL(string: creatorProfileUrl))
|
|
.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: 2.7) {
|
|
HStack(spacing: 2.7) {
|
|
if isAdult {
|
|
Text("19")
|
|
.font(.custom(Font.bold.rawValue, size: 8))
|
|
.foregroundColor(.white)
|
|
.padding(.vertical, 2.8)
|
|
.padding(.horizontal, 2)
|
|
.background(Circle().foregroundColor(Color.mainRed2))
|
|
}
|
|
|
|
Text(roomTitle)
|
|
.font(.custom(Font.bold.rawValue, size: 12))
|
|
.foregroundColor(.grayee)
|
|
.lineLimit(1)
|
|
}
|
|
|
|
Text(creatorNickname)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.foregroundColor(.gray77)
|
|
}
|
|
|
|
if isShowFollowingButton {
|
|
Image(isFollowing ? "btn_select_checked" : "btn_plus_round")
|
|
.resizable()
|
|
.frame(width: 20, height: 20)
|
|
.onTapGesture { onClickFollow() }
|
|
}
|
|
|
|
}
|
|
.padding(.vertical, 8)
|
|
.padding(.horizontal, 5.3)
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 5.3)
|
|
.stroke(Color.graybb, lineWidth: 1)
|
|
)
|
|
}
|
|
}
|
|
|
|
struct LiveRoomInfoCreatorView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
LiveRoomInfoCreatorView(
|
|
roomTitle: "오늘 라이브방송은 OOO 입니다.",
|
|
creatorNickname: "도화",
|
|
creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320",
|
|
isMute: false,
|
|
isAdult: false,
|
|
isFollowing: true,
|
|
isActiveSpeaker: true,
|
|
isShowFollowingButton: true,
|
|
onClickFollow: {},
|
|
onClickProfile: {}
|
|
)
|
|
}
|
|
}
|