| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import SwiftUI
- struct SettingsToggleRow: View {
- let icon: String
- let title: String
- var subtitle: String?
- @Binding var isOn: Bool
- var body: some View {
- HStack(spacing: 12) {
- Image(systemName: icon)
- .font(.system(size: 14, weight: .medium))
- .foregroundStyle(AppTheme.accentPurple)
- .frame(width: 32, height: 32)
- .background(
- RoundedRectangle(cornerRadius: 8)
- .fill(AppTheme.accentPurple.opacity(0.12))
- )
- VStack(alignment: .leading, spacing: 2) {
- Text(title)
- .font(.system(size: 13, weight: .medium))
- .foregroundStyle(AppTheme.textPrimary)
- if let subtitle {
- Text(subtitle)
- .font(.system(size: 10))
- .foregroundStyle(AppTheme.textSecondary)
- }
- }
- Spacer()
- Toggle("", isOn: $isOn)
- .labelsHidden()
- .toggleStyle(.switch)
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
- .background(AppTheme.panelBackground)
- .clipShape(RoundedRectangle(cornerRadius: 8))
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(AppTheme.cardBorder, lineWidth: 1)
- )
- .frame(maxWidth: .infinity, alignment: .leading)
- }
- }
- struct SettingsLinkRow: View {
- let icon: String
- let title: String
- var subtitle: String?
- let action: () -> Void
- var body: some View {
- Button(action: action) {
- HStack(spacing: 12) {
- Image(systemName: icon)
- .font(.system(size: 14, weight: .medium))
- .foregroundStyle(AppTheme.accentPurple)
- .frame(width: 32, height: 32)
- .background(
- RoundedRectangle(cornerRadius: 8)
- .fill(AppTheme.accentPurple.opacity(0.12))
- )
- VStack(alignment: .leading, spacing: 2) {
- Text(title)
- .font(.system(size: 13, weight: .medium))
- .foregroundStyle(AppTheme.textPrimary)
- if let subtitle {
- Text(subtitle)
- .font(.system(size: 10))
- .foregroundStyle(AppTheme.textSecondary)
- }
- }
- Spacer()
- Image(systemName: "arrow.up.right")
- .font(.system(size: 11, weight: .medium))
- .foregroundStyle(AppTheme.textTertiary)
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 10)
- .background(AppTheme.panelBackground)
- .clipShape(RoundedRectangle(cornerRadius: 8))
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(AppTheme.cardBorder, lineWidth: 1)
- )
- }
- .buttonStyle(AppPlainButtonStyle())
- .hoverCard(cornerRadius: 8)
- .frame(maxWidth: .infinity, alignment: .leading)
- }
- }
|