48 lines
1.4 KiB
Swift
48 lines
1.4 KiB
Swift
//
|
|
// EmployeeRowView.swift
|
|
// EmployeeDirectory
|
|
//
|
|
// Created by Matt Bruce on 3/3/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct EmployeeRowView: View {
|
|
let viewModel: EmployeeViewModel
|
|
let defaultImage = "person.circle.fill" // SF Symbol as fallback
|
|
|
|
var body: some View {
|
|
HStack(alignment: .top, spacing: 12) {
|
|
// Profile Image with Default Placeholder
|
|
ProfileImageView(urlString: viewModel.smallPhoto, size: 50) // Uses reusable component
|
|
|
|
// Employee Info Stack
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(viewModel.fullName)
|
|
.font(.headline)
|
|
|
|
if let bio = viewModel.biography {
|
|
Text(bio)
|
|
.font(.footnote)
|
|
.foregroundColor(.gray)
|
|
.lineLimit(2)
|
|
}
|
|
|
|
ContactButtonView(contactType: .email, contactValue: viewModel.emailAddress, enabled: false)
|
|
|
|
if let phone = viewModel.phoneNumber {
|
|
ContactButtonView(contactType: .phone, contactValue: phone, enabled: false)
|
|
}
|
|
}
|
|
|
|
Spacer() // Pushes everything to the left
|
|
}
|
|
.padding(.vertical, 8)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
EmployeeRowView(viewModel: .init(employee: MockEmployeeService.sample)).padding()
|
|
}
|
|
|