EmployeeDirectory-SwiftUI/EmployeeDirectory/Views/EmployeeDetailsView.swift
2025-03-04 14:54:57 -06:00

44 lines
1.2 KiB
Swift

//
// EmployeeDetailsView.swift
// EmployeeDirectory
//
// Created by Matt Bruce on 3/4/25.
//
import SwiftUI
struct EmployeeDetailsView: View {
let viewModel: EmployeeViewModel
let defaultImage = "person.circle.fill" // SF Symbol as fallback
var body: some View {
VStack(alignment: .leading, spacing: 12) {
// Profile Image with Default Placeholder
ProfileImageView(urlString: viewModel.largePhoto, size: 250) // Uses reusable component
.padding(.bottom)
Text(viewModel.fullName)
.font(.headline)
if let bio = viewModel.biography {
Text(bio)
.font(.footnote)
.foregroundColor(.gray)
.lineLimit(2)
}
ContactButtonView(contactType: .email, contactValue: viewModel.emailAddress)
if let phone = viewModel.phoneNumber {
ContactButtonView(contactType: .phone, contactValue: phone)
}
Spacer()
}
.padding(.all)
}
}
#Preview {
EmployeeDetailsView(viewModel: .init(employee: MockEmployeeService.sample)).padding(.all)
}