ProfileEditButton.swift (1232B)
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 } 31 32 func fillColor() -> Color { 33 colorScheme == .light ? DamusColors.black : DamusColors.white 34 } 35 36 func borderColor() -> Color { 37 colorScheme == .light ? DamusColors.black : DamusColors.white 38 } 39 } 40 41 42 struct ProfileEditButton_Previews: PreviewProvider { 43 static var previews: some View { 44 Group { 45 ProfileEditButton(damus_state: test_damus_state) 46 } 47 } 48 } 49 50