메시지 - 리스트, 쓰기, 상세 페이지 추가
This commit is contained in:
66
SodaLive/Sources/Message/Text/TextMessageItemView.swift
Normal file
66
SodaLive/Sources/Message/Text/TextMessageItemView.swift
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// TextMessageItemView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Kingfisher
|
||||
|
||||
struct TextMessageItemView: View {
|
||||
|
||||
let item: TextMessageItem
|
||||
|
||||
var body: some View {
|
||||
|
||||
let nickname = item.recipientNickname == UserDefaults.string(forKey: .nickname) ? item.senderNickname : item.recipientNickname
|
||||
|
||||
let profileUrl = item.recipientNickname == UserDefaults.string(forKey: .nickname) ? item.senderProfileImageUrl : item.recipientProfileImageUrl
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
KFImage(URL(string: profileUrl))
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 46.7, height: 46.7, alignment: .top)
|
||||
.cornerRadius(23.4)
|
||||
.clipped()
|
||||
|
||||
VStack(alignment: .leading, spacing: 4.7) {
|
||||
Text(nickname)
|
||||
.font(.custom(Font.medium.rawValue, size: 13.3))
|
||||
.foregroundColor(Color(hex: "eeeeee"))
|
||||
|
||||
Text(item.textMessage)
|
||||
.font(.custom(Font.light.rawValue, size: 12))
|
||||
.foregroundColor(Color(hex: "777777"))
|
||||
.multilineTextAlignment(.leading)
|
||||
.lineLimit(2)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Text(item.date)
|
||||
.font(.custom(Font.light.rawValue, size: 12))
|
||||
.foregroundColor(Color(hex: "525252"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct TextMessageItemView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
TextMessageItemView(
|
||||
item: TextMessageItem(
|
||||
messageId: 18,
|
||||
senderId: 19,
|
||||
senderNickname: "user8",
|
||||
senderProfileImageUrl: "https://test-cf.yozm.day/profile/default_profile.png",
|
||||
recipientNickname: "uset7",
|
||||
recipientProfileImageUrl: "https://test-cf.yozm.day/profile/default_profile.png",
|
||||
textMessage: "ㅅㅅㅅㅅㅅㅅㅅㅅ러러러라라가가각개가사러",
|
||||
date: "2022-05-23 16:15:22",
|
||||
isKept: false
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user