GlossyButton.swift

885 B · raw

1import SwiftUI23struct GlossyButton: View {4  let title: String5  let icon: String?6  let action: () -> Void7  var color: Color = .blue89  var body: some View {10    Button(action: action) {11      HStack(spacing: 6) {12        if let icon = icon {13          Image(systemName: icon)14            .font(.system(size: 14, weight: .semibold))15        }16        Text(title)17          .font(.system(size: 13, weight: .medium))18      }19      .padding(.horizontal, 12)20      .padding(.vertical, 8)21      .background(22        ZStack {23          RoundedRectangle(cornerRadius: 8)24            .fill(color.opacity(0.2))2526          RoundedRectangle(cornerRadius: 8)27            .stroke(color.opacity(0.4), lineWidth: 1)28            .shadow(color: color.opacity(0.3), radius: 2, x: 0, y: 1)29        }30      )31      .foregroundColor(.white)32      .shadow(radius: 2)33    }34    .buttonStyle(.plain)35  }36}