//
//  ChatMemberView.swift
//  Sailassist
//
//  Created by Mamoru Sugita on 2023/11/10.
//

import SwiftUI

struct ChatMemberView: View {
    @ObservedObject var message = SharingData.message
    var body: some View {
        VStack {
            List {
                ForEach(message.users, id: \.id) { user in
                    HStack {
                        if user.location == 1 {
                            Image("company_black")
                                .resizable()
                                .scaledToFill()
                                .frame(width: 12, height: 12)
                        } else {
                            Image("ship_black")
                                .resizable()
                                .scaledToFill()
                                .frame(width: 12, height: 12)
                        }

                        Text(user.name)
                            .foregroundColor(ColorSet.BodyChat.color)
                            .font(FontStyle.SupplementText.font)
                    }
                }
                .listRowBackground(ColorSet.ModalWindowFront.color)
                .listRowSeparatorTint(ColorSet.LineModal.color)
            }
            .scrollDisabled(true)
            .scrollContentBackground(.hidden)
            .background(ColorSet.ModalWindowBack.color)
            
            Spacer()
        }
    }
}

#Preview {
    ChatMemberView()
}
