import SwiftUI
import Bedrock

/// A row with an icon and text, used for contact info display.
/// Accepts a text color for flexibility with different background themes.
struct IconRowView: View {
    let systemImage: String
    let text: String
    var textColor: Color = Color.Text.inverted
    
    var body: some View {
        HStack(spacing: Design.Spacing.xSmall) {
            Image(systemName: systemImage)
                .font(.caption)
                .foregroundStyle(textColor.opacity(Design.Opacity.heavy))
            Text(text)
                .font(.caption)
                .foregroundStyle(textColor)
                .lineLimit(1)
        }
    }
}

#Preview {
    VStack(alignment: .leading, spacing: Design.Spacing.small) {
        IconRowView(systemImage: "envelope", text: "hello@example.com")
        IconRowView(systemImage: "phone", text: "+1 555 123 4567")
        IconRowView(systemImage: "link", text: "example.com", textColor: Color.Text.primary)
    }
    .padding()
    .background(Color.CardPalette.midnight)
}
