Skip to content

Commit 0091e13

Browse files
reezgithub-actions[bot]
authored andcommitted
ci: run swift-format
1 parent 7859097 commit 0091e13

1 file changed

Lines changed: 75 additions & 75 deletions

File tree

Sources/WalletUI/ButtonStyles.swift

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public struct BitcoinFilled: ButtonStyle {
6969
.padding()
7070
.frame(width: width, height: height)
7171
.background(
72-
stateBackgroundColor.opacity(0.8)
72+
stateBackgroundColor.opacity(0.8)
7373
.clipShape(CustomShape(isCapsule: isCapsule, cornerRadius: cornerRadius))
7474
)
7575
.foregroundColor(stateTextColor())
@@ -102,55 +102,55 @@ public struct BitcoinFilled: ButtonStyle {
102102
/// - Parameter disabledColor: The disabled color of the button (optional, default is .bitcoinNeutral4)
103103
///
104104
public struct BitcoinOutlined: ButtonStyle {
105-
@Environment(\.colorScheme) private var colorScheme
106-
@Environment(\.isEnabled) private var isEnabled
107-
108-
let width: CGFloat
109-
let height: CGFloat
110-
let cornerRadius: CGFloat
111-
let tintColor: Color
112-
let disabledColor: Color
113-
let isCapsule: Bool
114-
115-
public init(
116-
width: CGFloat = defaultButtonWidth, height: CGFloat = defaultButtonHeight,
117-
cornerRadius: CGFloat = defaultCornerRadius, tintColor: Color = defaultTintColor,
118-
disabledColor: Color = defaultDisabledOutlineColor,
119-
isCapsule: Bool = false
120-
) {
121-
self.width = width
122-
self.height = height
123-
self.cornerRadius = cornerRadius
124-
self.tintColor = tintColor
125-
self.disabledColor = disabledColor
126-
self.isCapsule = isCapsule
127-
}
105+
@Environment(\.colorScheme) private var colorScheme
106+
@Environment(\.isEnabled) private var isEnabled
128107

129-
public func makeBody(configuration: Configuration) -> some View {
130-
configuration.label
131-
.font(Font.body.bold())
132-
.padding()
133-
.frame(width: width, height: height)
134-
.background(stateBackgroundColor())
135-
.clipShape(CustomShape(isCapsule: isCapsule, cornerRadius: cornerRadius)) // Use CustomShape
136-
.foregroundColor(stateTextColor())
137-
.overlay(
138-
CustomShape(isCapsule: isCapsule, cornerRadius: cornerRadius) // Use CustomShape
139-
.stroke(stateBorderColor(configuration: configuration), lineWidth: 1.5)
140-
)
141-
.scaleEffect(configuration.isPressed ? 0.95 : 1)
142-
.animation(.easeOut(duration: 0.1), value: configuration.isPressed)
143-
}
108+
let width: CGFloat
109+
let height: CGFloat
110+
let cornerRadius: CGFloat
111+
let tintColor: Color
112+
let disabledColor: Color
113+
let isCapsule: Bool
144114

145-
private func stateBackgroundColor() -> Color {
146-
return colorScheme == .dark ? .bitcoinBlack : .bitcoinWhite
147-
}
148-
private func stateBorderColor(configuration: Configuration) -> Color {
149-
return isEnabled ? configuration.isPressed ? tintColor.opacity(0.8) : tintColor : disabledColor
150-
}
151-
private func stateTextColor() -> Color {
152-
return isEnabled ? tintColor : disabledColor
153-
}
115+
public init(
116+
width: CGFloat = defaultButtonWidth, height: CGFloat = defaultButtonHeight,
117+
cornerRadius: CGFloat = defaultCornerRadius, tintColor: Color = defaultTintColor,
118+
disabledColor: Color = defaultDisabledOutlineColor,
119+
isCapsule: Bool = false
120+
) {
121+
self.width = width
122+
self.height = height
123+
self.cornerRadius = cornerRadius
124+
self.tintColor = tintColor
125+
self.disabledColor = disabledColor
126+
self.isCapsule = isCapsule
127+
}
128+
129+
public func makeBody(configuration: Configuration) -> some View {
130+
configuration.label
131+
.font(Font.body.bold())
132+
.padding()
133+
.frame(width: width, height: height)
134+
.background(stateBackgroundColor())
135+
.clipShape(CustomShape(isCapsule: isCapsule, cornerRadius: cornerRadius)) // Use CustomShape
136+
.foregroundColor(stateTextColor())
137+
.overlay(
138+
CustomShape(isCapsule: isCapsule, cornerRadius: cornerRadius) // Use CustomShape
139+
.stroke(stateBorderColor(configuration: configuration), lineWidth: 1.5)
140+
)
141+
.scaleEffect(configuration.isPressed ? 0.95 : 1)
142+
.animation(.easeOut(duration: 0.1), value: configuration.isPressed)
143+
}
144+
145+
private func stateBackgroundColor() -> Color {
146+
return colorScheme == .dark ? .bitcoinBlack : .bitcoinWhite
147+
}
148+
private func stateBorderColor(configuration: Configuration) -> Color {
149+
return isEnabled ? configuration.isPressed ? tintColor.opacity(0.8) : tintColor : disabledColor
150+
}
151+
private func stateTextColor() -> Color {
152+
return isEnabled ? tintColor : disabledColor
153+
}
154154
}
155155

156156
/// A `ButtonStyle` corresponding to the Plain type in the Bitcoin Wallet UI Kit
@@ -207,16 +207,16 @@ public struct BitcoinPlain: ButtonStyle {
207207
}
208208

209209
private struct CustomShape: Shape {
210-
var isCapsule: Bool
211-
var cornerRadius: CGFloat
212-
213-
func path(in rect: CGRect) -> Path {
214-
if isCapsule {
215-
return Capsule().path(in: rect)
216-
} else {
217-
return RoundedRectangle(cornerRadius: cornerRadius).path(in: rect)
218-
}
210+
var isCapsule: Bool
211+
var cornerRadius: CGFloat
212+
213+
func path(in rect: CGRect) -> Path {
214+
if isCapsule {
215+
return Capsule().path(in: rect)
216+
} else {
217+
return RoundedRectangle(cornerRadius: cornerRadius).path(in: rect)
219218
}
219+
}
220220
}
221221

222222
struct ButtonStylesView: View {
@@ -237,27 +237,27 @@ struct ButtonStylesView: View {
237237
.padding(.top, .wallet_grid_vertical_20())
238238

239239
Spacer()
240-
241-
Button("BitcoinFilled") {}
242-
.buttonStyle(BitcoinFilled())
243-
.padding()
244-
245-
Button("BitcoinFilled") {}
246-
.buttonStyle(BitcoinFilled(isCapsule: true))
247-
.padding()
248-
240+
241+
Button("BitcoinFilled") {}
242+
.buttonStyle(BitcoinFilled())
243+
.padding()
244+
245+
Button("BitcoinFilled") {}
246+
.buttonStyle(BitcoinFilled(isCapsule: true))
247+
.padding()
248+
249249
Button("BitcoinPlain") {}
250250
.buttonStyle(BitcoinPlain())
251251
.padding()
252-
253-
Button("BitcoinOutlined") {}
254-
.buttonStyle(BitcoinOutlined())
255-
.padding()
256-
257-
Button("BitcoinOutlined") {}
258-
.buttonStyle(BitcoinOutlined(isCapsule: true))
259-
.padding()
260-
252+
253+
Button("BitcoinOutlined") {}
254+
.buttonStyle(BitcoinOutlined())
255+
.padding()
256+
257+
Button("BitcoinOutlined") {}
258+
.buttonStyle(BitcoinOutlined(isCapsule: true))
259+
.padding()
260+
261261
Spacer()
262262

263263
}

0 commit comments

Comments
 (0)