GradientButton.swift 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import SwiftUI
  2. struct GradientButton: View {
  3. let title: String
  4. let action: () -> Void
  5. var body: some View {
  6. Button(action: action) {
  7. HStack(spacing: 10) {
  8. Image(systemName: "sparkles")
  9. .font(.system(size: 15, weight: .semibold))
  10. Text(title)
  11. .font(.system(size: 16, weight: .semibold))
  12. .textSelection(.disabled)
  13. Image(systemName: "arrow.right")
  14. .font(.system(size: 14, weight: .semibold))
  15. }
  16. .foregroundStyle(.white)
  17. .padding(.horizontal, 28)
  18. .padding(.vertical, 15)
  19. .frame(maxWidth: .infinity)
  20. .background(AppTheme.primaryGradient)
  21. .clipShape(Capsule())
  22. .shadow(color: AppTheme.teal.opacity(0.30), radius: 10, y: 4)
  23. }
  24. .buttonStyle(.plain)
  25. }
  26. }
  27. struct ToolbarButton: View {
  28. let title: String
  29. let iconName: String
  30. let action: () -> Void
  31. var body: some View {
  32. Button(action: action) {
  33. HStack(spacing: 6) {
  34. Image(systemName: iconName)
  35. .font(.system(size: 12))
  36. Text(title)
  37. .font(.system(size: 12, weight: .medium))
  38. }
  39. .foregroundStyle(AppTheme.textSecondary)
  40. .padding(.horizontal, 12)
  41. .padding(.vertical, 7)
  42. .background(Color.white)
  43. .clipShape(RoundedRectangle(cornerRadius: 8))
  44. .overlay(
  45. RoundedRectangle(cornerRadius: 8)
  46. .stroke(AppTheme.border, lineWidth: 1)
  47. )
  48. .shadow(color: Color.black.opacity(0.03), radius: 2, y: 1)
  49. }
  50. .buttonStyle(.plain)
  51. }
  52. }
  53. struct IconButton: View {
  54. let iconName: String
  55. let action: () -> Void
  56. var body: some View {
  57. Button(action: action) {
  58. Image(systemName: iconName)
  59. .font(.system(size: 14))
  60. .foregroundStyle(AppTheme.textSecondary)
  61. .frame(width: 36, height: 36)
  62. .background(Color.white)
  63. .clipShape(RoundedRectangle(cornerRadius: 8))
  64. .overlay(
  65. RoundedRectangle(cornerRadius: 8)
  66. .stroke(AppTheme.border, lineWidth: 1)
  67. )
  68. .shadow(color: Color.black.opacity(0.04), radius: 3, y: 1)
  69. }
  70. .buttonStyle(.plain)
  71. }
  72. }