damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

RelayAuthenticationDetail.swift (2273B)


      1 //
      2 //  RelayAuthenticationDetail.swift
      3 //  damus
      4 //
      5 //  Created by Charlie Fish on 12/18/23.
      6 //
      7 
      8 import SwiftUI
      9 
     10 struct RelayAuthenticationDetail: View {
     11     let state: RelayAuthenticationState
     12 
     13     var body: some View {
     14         switch state {
     15         case .none:
     16             EmptyView()
     17         case .pending:
     18             Text("Pending", comment: "Label to display that authentication to a server is pending.")
     19                 .font(.caption)
     20                 .frame(height: 20)
     21                 .padding(.horizontal, 10)
     22                 .foregroundColor(DamusColors.warning)
     23                 .background(DamusColors.warningQuaternary)
     24                 .cornerRadius(20)
     25                 .overlay(
     26                     RoundedRectangle(cornerRadius: 20)
     27                         .stroke(DamusColors.warningBorder, lineWidth: 1)
     28                 )
     29         case .verified:
     30             Text("Authenticated", comment: "Label to display that authentication to a server has succeeded.")
     31                 .font(.caption)
     32                 .frame(height: 20)
     33                 .padding(.horizontal, 10)
     34                 .foregroundColor(DamusColors.success)
     35                 .background(DamusColors.successQuaternary)
     36                 .cornerRadius(20)
     37                 .overlay(
     38                     RoundedRectangle(cornerRadius: 20)
     39                         .stroke(DamusColors.successBorder, lineWidth: 1)
     40                 )
     41         case .error:
     42             Text("Error", comment: "Label to display that authentication to a server has failed.")
     43                 .font(.caption)
     44                 .frame(height: 20)
     45                 .padding(.horizontal, 10)
     46                 .foregroundColor(DamusColors.danger)
     47                 .background(DamusColors.dangerQuaternary)
     48                 .border(DamusColors.dangerBorder)
     49                 .cornerRadius(20)
     50                 .overlay(
     51                     RoundedRectangle(cornerRadius: 20)
     52                         .stroke(DamusColors.dangerBorder, lineWidth: 1)
     53                 )
     54         }
     55     }
     56 }
     57 
     58 struct RelayAuthenticationDetail_Previews: PreviewProvider {
     59     static var previews: some View {
     60         RelayAuthenticationDetail(state: .none)
     61         RelayAuthenticationDetail(state: .pending)
     62         RelayAuthenticationDetail(state: .verified)
     63     }
     64 }