mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:06:00 +00:00
Design review for first public TestFlight (#492)
* 430 - Design review for first public TestFlight
This commit is contained in:
@@ -22,7 +22,7 @@ public extension ButtonStyle where Self == ElementGhostButtonStyle {
|
||||
/// - Parameter size: The control size to use. Defaults to `regular`.
|
||||
/// - Parameter color: The color of the label and border. Defaults to the accent color.
|
||||
static func elementGhost(_ size: ElementControlSize = .regular,
|
||||
color: Color = .element.accent) -> ElementGhostButtonStyle {
|
||||
color: Color = .element.primaryContent) -> ElementGhostButtonStyle {
|
||||
ElementGhostButtonStyle(size: size, color: color)
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public struct ElementGhostButtonStyle: ButtonStyle {
|
||||
private var verticalPadding: CGFloat { size == .xLarge ? 12 : 4 }
|
||||
private var maxWidth: CGFloat? { size == .xLarge ? .infinity : nil }
|
||||
|
||||
public init(size: ElementControlSize = .regular, color: Color = .element.accent) {
|
||||
public init(size: ElementControlSize = .regular, color: Color = .element.primaryContent) {
|
||||
self.size = size
|
||||
self.color = color
|
||||
}
|
||||
@@ -47,19 +47,19 @@ public struct ElementGhostButtonStyle: ButtonStyle {
|
||||
.padding(.vertical, verticalPadding)
|
||||
.frame(maxWidth: maxWidth)
|
||||
.foregroundColor(color)
|
||||
.font(.element.body)
|
||||
.font(.element.footnoteBold)
|
||||
.background(border)
|
||||
.opacity(opacity(when: configuration.isPressed))
|
||||
}
|
||||
|
||||
private var border: some View {
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
Capsule()
|
||||
.strokeBorder()
|
||||
.foregroundColor(color)
|
||||
}
|
||||
|
||||
private func opacity(when isPressed: Bool) -> CGFloat {
|
||||
guard isEnabled else { return 0.6 }
|
||||
guard isEnabled else { return 0.5 }
|
||||
return isPressed ? 0.6 : 1.0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user