Skip to content

Instantly share code, notes, and snippets.

@prafullakumar
Created June 7, 2020 02:18
Show Gist options
  • Save prafullakumar/93148ee83b51f10cd19e014834137233 to your computer and use it in GitHub Desktop.
Save prafullakumar/93148ee83b51f10cd19e014834137233 to your computer and use it in GitHub Desktop.
import SwiftUI
public struct PrimaryButton: ViewModifier {
public func body(content: Content) -> some View {
content.foregroundColor(Color.theme)
.padding()
.font(Font.system(size: Matrix.paragraphSize,
weight: .semibold,
design: .default))
.overlay(
RoundedRectangle(cornerRadius: 20)
.stroke(Color.theme, lineWidth: 1)
)
}
}
extension View {
public func primaryButton() -> some View {
self.modifier(PrimaryButton())
}
}
public struct SecondaryButton: ViewModifier {
public func body(content: Content) -> some View {
content
.foregroundColor(Color.solidButtontext)
.padding() //can add custom padding with matrix class
.font(Font.system(size: Matrix.paragraphSize,
weight: .semibold,
design: .default))
.background(Color.theme)
.cornerRadius(Matrix.cornerRadius)
}
}
extension View {
public func secondaryButton() -> some View {
self.modifier(SecondaryButton())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment