feat(ios): add native app foundation and unsigned ipa build
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import SwiftUI
|
||||
|
||||
public struct AIButtonStyle: ButtonStyle {
|
||||
public enum Kind: Hashable {
|
||||
case primary
|
||||
case secondary
|
||||
case danger
|
||||
|
||||
var foregroundColor: Color {
|
||||
switch self {
|
||||
case .primary, .danger: return .white
|
||||
case .secondary: return AITheme.ink
|
||||
}
|
||||
}
|
||||
|
||||
var backgroundColor: Color {
|
||||
switch self {
|
||||
case .primary: return AITheme.primary
|
||||
case .secondary: return AITheme.surface
|
||||
case .danger: return AITheme.danger
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum Size: Hashable {
|
||||
case compact
|
||||
case regular
|
||||
case large
|
||||
}
|
||||
|
||||
private let kind: Kind
|
||||
private let size: Size
|
||||
|
||||
public init(kind: Kind = .secondary, size: Size = .regular) {
|
||||
self.kind = kind
|
||||
self.size = size
|
||||
}
|
||||
|
||||
public func makeBody(configuration: Configuration) -> some View {
|
||||
let height: CGFloat = switch size {
|
||||
case .compact: AITheme.compactButtonHeight
|
||||
case .large: AITheme.largeButtonHeight
|
||||
case .regular: AITheme.buttonHeight
|
||||
}
|
||||
|
||||
configuration.label
|
||||
.font(.system(size: 15, weight: .semibold))
|
||||
.foregroundStyle(kind.foregroundColor)
|
||||
.frame(minWidth: 44, minHeight: height)
|
||||
.padding(.horizontal, 14)
|
||||
.background(kind.backgroundColor)
|
||||
.clipShape(RoundedRectangle(cornerRadius: AITheme.buttonRadius))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: AITheme.buttonRadius)
|
||||
.strokeBorder(kind == .secondary ? AITheme.line : .clear)
|
||||
}
|
||||
.opacity(configuration.isPressed ? 0.78 : 1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user