AlbyButton.swift (1246B)
1 // 2 // AlbyButton.swift 3 // damus 4 // 5 // Created by William Casarin on 2023-05-09. 6 // 7 8 import SwiftUI 9 10 struct AlbyButton: View { 11 let action: () -> () 12 13 @Environment(\.colorScheme) var colorScheme 14 15 init(action: @escaping () -> ()) { 16 self.action = action 17 } 18 19 var body: some View { 20 Button(action: { 21 action() 22 }) { 23 HStack { 24 Image("alby") 25 26 Text("Connect to Alby Wallet", comment: "Button to attach an Alby Wallet, a service that provides a Lightning wallet for zapping sats. Alby is the name of the service and should not be translated.") 27 .padding() 28 } 29 .frame(minWidth: 300, maxWidth: .infinity, alignment: .center) 30 .foregroundColor(DamusColors.black) 31 .background { 32 RoundedRectangle(cornerRadius: 12) 33 .fill(AlbyGradient, strokeBorder: colorScheme == .light ? DamusColors.black.opacity(0.2) : DamusColors.white, lineWidth: 1) 34 } 35 } 36 } 37 } 38 39 struct AlbyButton_Previews: PreviewProvider { 40 static var previews: some View { 41 AlbyButton(action: { 42 print("alby button") 43 }) 44 } 45 }