ChatListCellView.swift 730 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // ChatListCellView.swift
  3. // Chat (iOS)
  4. //
  5. // Created by Sergey Tarasov on 14.10.2022.
  6. //
  7. import SwiftUI
  8. struct ChatListCellView: View {
  9. let nickname: String
  10. let jid: String
  11. var body: some View {
  12. NavigationLink {
  13. ChatView(store: ChatStore(with: jid))
  14. } label: {
  15. HStack {
  16. Image(systemName: "person.crop.circle")
  17. .resizable()
  18. .scaledToFit()
  19. .foregroundColor(.secondary.opacity(0.5))
  20. Text(nickname)
  21. Spacer()
  22. }
  23. .foregroundColor(.primary)
  24. .frame(height: 30)
  25. }
  26. }
  27. }
  28. struct ChatListCellView_Previews: PreviewProvider {
  29. static var previews: some View {
  30. ChatListCellView(nickname: "Nickname", jid: "user@domain.com")
  31. .padding()
  32. .previewLayout(.sizeThatFits)
  33. }
  34. }