damus

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

ProfileEditButton.swift (1327B)


      1 //
      2 //  ProfileEditButton.swift
      3 //  damus
      4 //
      5 //  Created by William Casarin on 2023-07-17.
      6 //
      7 
      8 import SwiftUI
      9 
     10 struct ProfileEditButton: View {
     11     let damus_state: DamusState
     12 
     13     @Environment(\.colorScheme) var colorScheme
     14 
     15     var body: some View {
     16         NavigationLink(value: Route.EditMetadata) {
     17             Text("Edit", comment: "Button to edit user's profile.")
     18                 .frame(height: 30)
     19                 .padding(.horizontal,25)
     20                 .font(.caption.weight(.bold))
     21                 .foregroundColor(fillColor())
     22                 .cornerRadius(24)
     23                 .overlay {
     24                     RoundedRectangle(cornerRadius: 24)
     25                         .stroke(borderColor(), lineWidth: 1)
     26                 }
     27                 .minimumScaleFactor(0.5)
     28                 .lineLimit(1)
     29         }
     30         .accessibilityIdentifier(AppAccessibilityIdentifiers.own_profile_edit_button.rawValue)
     31     }
     32 
     33     func fillColor() -> Color {
     34         colorScheme == .light ? DamusColors.black : DamusColors.white
     35     }
     36 
     37     func borderColor() -> Color {
     38         colorScheme == .light ? DamusColors.black : DamusColors.white
     39     }
     40 }
     41 
     42 
     43 struct ProfileEditButton_Previews: PreviewProvider {
     44     static var previews: some View {
     45         Group {
     46             ProfileEditButton(damus_state: test_damus_state)
     47         }
     48     }
     49 }
     50 
     51