From a3e67c1fa2bfadf797c4e9924973c53909cbe0c0 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Wed, 30 Nov 2022 11:17:06 +0100 Subject: [PATCH] Add GroupAuthStatusView --- .../SharedUI/GroupAuthStatusView.swift | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Examples/xx-messenger/Sources/AppCore/SharedUI/GroupAuthStatusView.swift diff --git a/Examples/xx-messenger/Sources/AppCore/SharedUI/GroupAuthStatusView.swift b/Examples/xx-messenger/Sources/AppCore/SharedUI/GroupAuthStatusView.swift new file mode 100644 index 00000000..bddb9314 --- /dev/null +++ b/Examples/xx-messenger/Sources/AppCore/SharedUI/GroupAuthStatusView.swift @@ -0,0 +1,57 @@ +import SwiftUI +import XXModels + +public struct GroupAuthStatusView: View { + public init(_ authStatus: XXModels.Group.AuthStatus) { + self.authStatus = authStatus + } + + public var authStatus: XXModels.Group.AuthStatus + + public var body: some View { + switch authStatus { + case .pending: + HStack { + Text("Pending") + Spacer() + Image(systemName: "envelope.badge") + } + + case .deleting: + HStack { + Text("Deleting") + Spacer() + ProgressView() + } + + case .participating: + HStack { + Text("Participating") + Spacer() + Image(systemName: "checkmark") + } + + case .hidden: + HStack { + Text("Hidden") + Spacer() + Image(systemName: "eye.slash") + } + } + } +} + +#if DEBUG +struct GroupAuthStatusView_Previews: PreviewProvider { + static var previews: some View { + NavigationView { + Form { + Section { GroupAuthStatusView(.pending) } + Section { GroupAuthStatusView(.deleting) } + Section { GroupAuthStatusView(.participating) } + Section { GroupAuthStatusView(.hidden) } + } + } + } +} +#endif -- GitLab