import SwiftUI
import Bedrock

/// A generic action row with icon, title, optional subtitle, and chevron.
/// Used for share options, settings rows, and navigation items.
struct ActionRowView<Action: View>: View {
    let title: String
    let subtitle: String?
    let systemImage: String
    @ViewBuilder let action: () -> Action
    
    init(
        title: String,
        subtitle: String? = nil,
        systemImage: String,
        @ViewBuilder action: @escaping () -> Action
    ) {
        self.title = title
        self.subtitle = subtitle
        self.systemImage = systemImage
        self.action = action
    }
    
    var body: some View {
        action()
            .buttonStyle(.plain)
    }
}

#Preview {
    VStack(spacing: Design.Spacing.medium) {
        ActionRowContent(
            title: "Share via NFC",
            subtitle: "Tap phones to share instantly",
            systemImage: "dot.radiowaves.left.and.right"
        )
        
        ActionRowContent(
            title: "Copy Link",
            systemImage: "link"
        )
    }
    .padding()
    .background(Color.AppBackground.base)
}
