No Description

ProfileSummary.swift 3.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // ProfileView.swift
  3. // Comedores Sociales
  4. //
  5. // Created by Hector Carrion on 12/16/20.
  6. //
  7. import SwiftUI
  8. struct ProfileSummary: View {
  9. @State var profile: Profile
  10. var body: some View {
  11. VStack(alignment: .leading, spacing: 10) {
  12. HStack {
  13. Image(systemName: "person.crop.circle")
  14. .font(.system(size: 100))
  15. VStack(alignment: .leading, spacing: 5) {
  16. Text(profile.name)
  17. .bold()
  18. .font(.title)
  19. Text(profile.membership)
  20. .font(.headline)
  21. }
  22. }.padding()
  23. .frame(width: 350, height: 125, alignment: .topLeading)
  24. .offset(x: -10, y: 10.0)
  25. HStack {
  26. Image(systemName: "envelope")
  27. .font(.system(size: 20))
  28. .foregroundColor(.gray)
  29. Text(profile.email)
  30. .font(.headline)
  31. .foregroundColor(.gray)
  32. }.padding()
  33. .offset(x: 0, y: 10.0)
  34. HStack {
  35. Image(systemName: "phone")
  36. .font(.system(size: 20))
  37. .foregroundColor(.gray)
  38. Text(profile.phone)
  39. .font(.headline)
  40. .foregroundColor(.gray)
  41. }.padding()
  42. HStack() {
  43. VStack {
  44. Text(String(profile.hoursWorked))
  45. .font(.title)
  46. .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
  47. Text(NSLocalizedString("hours_donated", comment:""))
  48. .foregroundColor(.gray)
  49. }.padding()
  50. Spacer()
  51. VStack {
  52. if profile.membershipStatus == .expired {
  53. Text(NSLocalizedString("expired", comment:""))
  54. .font(.title)
  55. .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
  56. .foregroundColor(.red)
  57. } else if profile.membershipStatus == .valid {
  58. Text(NSLocalizedString("valid", comment:""))
  59. .font(.title)
  60. .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
  61. .foregroundColor(.green)
  62. } else {
  63. Text(NSLocalizedString("unknown", comment:""))
  64. .font(.title)
  65. .fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
  66. .foregroundColor(.orange)
  67. }
  68. Text(NSLocalizedString("membership", comment:""))
  69. .foregroundColor(.gray)
  70. }.padding()
  71. }.padding()
  72. .offset(x: 0, y: -10)
  73. Spacer()
  74. }
  75. }
  76. }
  77. struct ProfileSummary_Previews: PreviewProvider {
  78. static var previews: some View {
  79. ProfileSummary(profile: Profile.default)
  80. }
  81. }