BigButton.swift (1107B)
1 // 2 // BigButton.swift 3 // damus 4 // 5 // Created by William Casarin on 2023-04-19. 6 // 7 8 import SwiftUI 9 10 struct BigButton: View { 11 let text: String 12 let action: () -> () 13 14 @Environment(\.colorScheme) var colorScheme 15 16 init(_ text: String, action: @escaping () -> ()) { 17 self.text = text 18 self.action = action 19 } 20 21 var body: some View { 22 Button(action: { 23 action() 24 }) { 25 Text(text) 26 .frame(minWidth: 300, maxWidth: .infinity, minHeight: 50, maxHeight: 50, alignment: .center) 27 .foregroundColor(colorScheme == .light ? DamusColors.black : DamusColors.white) 28 .overlay { 29 RoundedRectangle(cornerRadius: 24) 30 .stroke(colorScheme == .light ? DamusColors.black : DamusColors.white, lineWidth: 2) 31 } 32 .padding(EdgeInsets(top: 10, leading: 50, bottom: 25, trailing: 50)) 33 } 34 } 35 } 36 37 struct BigButton_Previews: PreviewProvider { 38 static var previews: some View { 39 BigButton("Cancel", action: {}) 40 } 41 }