import SwiftUI
import Bedrock

/// A small badge displaying a label like "Work" or "Personal".
struct LabelBadgeView: View {
    let label: String
    let accentColor: Color
    var textColor: Color = Color.Text.inverted
    
    var body: some View {
        Text(String.localized(label))
            .font(.caption)
            .bold()
            .foregroundStyle(textColor)
            .padding(.horizontal, Design.Spacing.small)
            .padding(.vertical, Design.Spacing.xxSmall)
            .background(accentColor.opacity(Design.Opacity.medium))
            .clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
    }
}

#Preview {
    HStack {
        LabelBadgeView(label: "Work", accentColor: Color.CardPalette.coral)
        LabelBadgeView(label: "Personal", accentColor: Color.CardPalette.ocean, textColor: Color.Text.primary)
    }
    .padding()
    .background(Color.CardPalette.midnight)
}
