110 lines
3.0 KiB
Swift
110 lines
3.0 KiB
Swift
import SwiftUI
|
|
|
|
public struct AICard<Content: View>: View {
|
|
private let content: Content
|
|
|
|
public init(@ViewBuilder content: () -> Content) {
|
|
self.content = content()
|
|
}
|
|
|
|
public var body: some View {
|
|
content
|
|
.padding(16)
|
|
.background(AITheme.surface)
|
|
.clipShape(RoundedRectangle(cornerRadius: AITheme.cardRadius))
|
|
.overlay {
|
|
RoundedRectangle(cornerRadius: AITheme.cardRadius)
|
|
.strokeBorder(AITheme.line)
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct AITag: View {
|
|
private let text: String
|
|
private let tint: Color
|
|
|
|
public init(_ text: String, tint: Color = AITheme.primary) {
|
|
self.text = text
|
|
self.tint = tint
|
|
}
|
|
|
|
public var body: some View {
|
|
Text(text)
|
|
.font(.system(size: 12, weight: .semibold))
|
|
.foregroundStyle(tint)
|
|
.padding(.horizontal, 9)
|
|
.frame(minHeight: 26)
|
|
.background(tint.opacity(0.10))
|
|
.clipShape(Capsule())
|
|
}
|
|
}
|
|
|
|
public struct AIFieldStyle: TextFieldStyle {
|
|
public init() {}
|
|
|
|
public func _body(configuration: TextField<Self._Label>) -> some View {
|
|
configuration
|
|
.padding(.horizontal, 12)
|
|
.frame(minHeight: AITheme.buttonHeight)
|
|
.background(AITheme.canvas)
|
|
.clipShape(RoundedRectangle(cornerRadius: AITheme.buttonRadius))
|
|
.overlay {
|
|
RoundedRectangle(cornerRadius: AITheme.buttonRadius)
|
|
.strokeBorder(AITheme.line)
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct AISearchField: View {
|
|
private let placeholder: String
|
|
@Binding private var text: String
|
|
private var onSubmit: (() -> Void)?
|
|
|
|
public init(
|
|
_ placeholder: String,
|
|
text: Binding<String>,
|
|
onSubmit: (() -> Void)? = nil
|
|
) {
|
|
self.placeholder = placeholder
|
|
self._text = text
|
|
self.onSubmit = onSubmit
|
|
}
|
|
|
|
public var body: some View {
|
|
HStack(spacing: 8) {
|
|
Image(systemName: "magnifyingglass")
|
|
.foregroundStyle(AITheme.muted)
|
|
TextField(placeholder, text: $text)
|
|
.textFieldStyle(.plain)
|
|
.onSubmit {
|
|
onSubmit?()
|
|
}
|
|
}
|
|
.padding(.horizontal, 12)
|
|
.frame(minHeight: AITheme.buttonHeight)
|
|
.background(AITheme.surface)
|
|
.clipShape(RoundedRectangle(cornerRadius: AITheme.buttonRadius))
|
|
.overlay {
|
|
RoundedRectangle(cornerRadius: AITheme.buttonRadius)
|
|
.strokeBorder(AITheme.line)
|
|
}
|
|
}
|
|
}
|
|
|
|
public struct AIBrandBar: View {
|
|
public init() {}
|
|
|
|
public var body: some View {
|
|
HStack(spacing: 10) {
|
|
Image(systemName: "antenna.radiowaves.left.and.right")
|
|
Text(AppMetadata.name)
|
|
.font(.headline)
|
|
Spacer()
|
|
}
|
|
.foregroundStyle(.white)
|
|
.padding(.horizontal, 16)
|
|
.padding(.vertical, 12)
|
|
.background(Color(red: 0.075, green: 0.118, blue: 0.188))
|
|
}
|
|
}
|