Skip to content

Commit

Permalink
Update NeumophismButtonStyle.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Aug 28, 2024
1 parent 8a1d61c commit e36a8b5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Sources/NeumophismButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ public struct NeumophismButtonStyle: ButtonStyle {
@EnvironmentObject var neumorphism: NeumorphismManager

private var shapeType: ShapeType
private let fontColor: Color?
private let baseColor: Color?

init(shapeType: ShapeType, fontColor: Color?, baseColor: Color?) {
init(shapeType: ShapeType, baseColor: Color?) {
self.shapeType = shapeType
self.fontColor = fontColor
self.baseColor = baseColor
}

public func makeBody(configuration: Configuration) -> some View {
configuration.label
.foregroundColor(fontColor ?? neumorphism.fontColor())
.background(
Rectangle()
.clipShape(shapeType.anyShape)
Expand All @@ -41,7 +38,7 @@ public struct NeumophismButtonStyle: ButtonStyle {

@available(iOS 13.0, *)
public extension ButtonStyle where Self == NeumophismButtonStyle {
static func neumophismButton(shapeType: ShapeType, fontColor: Color? = nil, baseColor: Color? = nil) -> Self {
.init(shapeType: shapeType, fontColor: fontColor, baseColor: baseColor)
static func neumophismButton(shapeType: ShapeType, baseColor: Color? = nil) -> Self {
.init(shapeType: shapeType, baseColor: baseColor)
}
}

0 comments on commit e36a8b5

Please sign in to comment.