mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-21 00:44:46 +00:00
73 lines
1.8 KiB
Swift
73 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
enum SettingsLayout {
|
|
static let scrollbarGutter: CGFloat = 36
|
|
}
|
|
|
|
struct SettingsPageHeader: View {
|
|
let title: String
|
|
let subtitle: String?
|
|
|
|
init(title: String, subtitle: String? = nil) {
|
|
self.title = title
|
|
self.subtitle = subtitle
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 5) {
|
|
Text(self.title)
|
|
.font(.title3.weight(.semibold))
|
|
if let subtitle, !subtitle.isEmpty {
|
|
Text(subtitle)
|
|
.font(.callout)
|
|
.foregroundStyle(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SettingsSection<Content: View>: View {
|
|
let title: String
|
|
let content: Content
|
|
|
|
init(_ title: String, @ViewBuilder content: () -> Content) {
|
|
self.title = title
|
|
self.content = content()
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
Text(self.title)
|
|
.font(.headline)
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
self.content
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SettingsToggleRow: View {
|
|
let title: String
|
|
let subtitle: String?
|
|
@Binding var binding: Bool
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
Toggle(isOn: self.$binding) {
|
|
Text(self.title)
|
|
.font(.body)
|
|
}
|
|
.toggleStyle(.checkbox)
|
|
|
|
if let subtitle, !subtitle.isEmpty {
|
|
Text(subtitle)
|
|
.font(.footnote)
|
|
.foregroundStyle(.tertiary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
}
|
|
}
|
|
}
|