SettingsComponents.swift 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import SwiftUI
  2. struct SettingsShareAppButton: View {
  3. let message: String
  4. let url: URL
  5. var body: some View {
  6. ShareLink(item: url, message: Text(message)) {
  7. HStack(spacing: 14) {
  8. Image(systemName: "square.and.arrow.up")
  9. .font(.system(size: 16, weight: .semibold))
  10. .foregroundStyle(.white)
  11. .frame(width: 40, height: 40)
  12. .background(
  13. RoundedRectangle(cornerRadius: 10)
  14. .fill(AppTheme.accentPurple)
  15. )
  16. VStack(alignment: .leading, spacing: 2) {
  17. Text("Share App")
  18. .font(.system(size: 14, weight: .semibold))
  19. .foregroundStyle(AppTheme.textPrimary)
  20. Text("Tell friends about \(AppLinks.appName)")
  21. .font(.system(size: 11))
  22. .foregroundStyle(AppTheme.textSecondary)
  23. }
  24. Spacer()
  25. Image(systemName: "chevron.right")
  26. .font(.system(size: 11, weight: .semibold))
  27. .foregroundStyle(AppTheme.textTertiary)
  28. }
  29. .padding(14)
  30. .background(
  31. RoundedRectangle(cornerRadius: AppTheme.cornerRadiusSmall)
  32. .fill(AppTheme.cardBackground)
  33. .overlay(
  34. RoundedRectangle(cornerRadius: AppTheme.cornerRadiusSmall)
  35. .stroke(AppTheme.accentPurple.opacity(0.35), lineWidth: 1)
  36. )
  37. )
  38. }
  39. .buttonStyle(AppPlainButtonStyle())
  40. .hoverCard(cornerRadius: AppTheme.cornerRadiusSmall)
  41. .frame(maxWidth: .infinity, alignment: .leading)
  42. }
  43. }
  44. struct SettingsLinkRow: View {
  45. let icon: String
  46. let title: String
  47. var subtitle: String?
  48. let action: () -> Void
  49. var body: some View {
  50. Button(action: action) {
  51. HStack(spacing: 12) {
  52. Image(systemName: icon)
  53. .font(.system(size: 14, weight: .medium))
  54. .foregroundStyle(AppTheme.accentPurple)
  55. .frame(width: 32, height: 32)
  56. .background(
  57. RoundedRectangle(cornerRadius: 8)
  58. .fill(AppTheme.accentPurple.opacity(0.12))
  59. )
  60. VStack(alignment: .leading, spacing: 2) {
  61. Text(title)
  62. .font(.system(size: 13, weight: .medium))
  63. .foregroundStyle(AppTheme.textPrimary)
  64. if let subtitle {
  65. Text(subtitle)
  66. .font(.system(size: 10))
  67. .foregroundStyle(AppTheme.textSecondary)
  68. }
  69. }
  70. Spacer()
  71. Image(systemName: "arrow.up.right")
  72. .font(.system(size: 11, weight: .medium))
  73. .foregroundStyle(AppTheme.textTertiary)
  74. }
  75. .padding(.horizontal, 12)
  76. .padding(.vertical, 10)
  77. .background(AppTheme.panelBackground)
  78. .clipShape(RoundedRectangle(cornerRadius: 8))
  79. .overlay(
  80. RoundedRectangle(cornerRadius: 8)
  81. .stroke(AppTheme.cardBorder, lineWidth: 1)
  82. )
  83. }
  84. .buttonStyle(AppPlainButtonStyle())
  85. .hoverCard(cornerRadius: 8)
  86. .frame(maxWidth: .infinity, alignment: .leading)
  87. }
  88. }