summaryrefslogtreecommitdiff
path: root/makima/ios/Sources/Makima/Design/Components/Badge.swift
blob: 4c870a714630205b6bd3595975ea2f222e5cd662 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import SwiftUI

/// Small inline badge — mirrors the web's
/// `px-2 py-1 border border-[#3f6fb3] bg-[#0f1c2f] text-[#9bc3ff] font-mono text-xs tracking-wide uppercase`
struct Badge: View {
    let text: String
    var subtitle: String?

    var body: some View {
        HStack(spacing: 6) {
            Text(text)
                .font(.system(.footnote, design: .default))
                .foregroundStyle(Palette.accent)
            if let subtitle {
                Text("·")
                    .font(Typography.navLabel)
                    .foregroundStyle(Palette.borderMuted)
                Text(subtitle)
                    .font(Typography.navLabel)
                    .foregroundStyle(Palette.foregroundMuted)
            }
        }
        .padding(.horizontal, 8)
        .padding(.vertical, 4)
        .background(Palette.panel)
        .overlay(Rectangle().strokeBorder(Palette.border, lineWidth: 1))
    }
}