PURPOSE
Renders a circular letter badge intended to dangle off the upper-left corner of a rarity card. The colored fill matches the rarity tier, and the centered letter is drawn in Cal Sans white with a black stroke approximated via multi-layer text-shadow.
OWNS
- The
RarityBadgenamed React function component. - The local
Propsinterface (letter,fill,radius, optionalstyle). - The inline-style computation for the badge wrapper
<div>, including circle geometry (size = radius * 2), letter sizing (fontSize = round(radius * 1.05)), border, drop shadow, font stack, and the four-direction text-shadow stroke.
READS FROM
Props.letter— single character/string painted in the center.Props.fill— CSS color used as the circle background.Props.radius— outer-circle radius in pixels, drives bothsizeandfontSize.Props.style— optionalCSSPropertiesspread over the computed style object, so callers can override or extend (typically for positioning relative to the parent card).CSSPropertiestype imported fromreact.
PUSHES TO
- Returns a single
<div aria-hidden>JSX element with all styling applied inline. No external state, store, or DOM target is written.
DOES NOT
- Does not import or consume any rarity data, theme, or store; the caller supplies
letterandfilldirectly. - Does not position itself; absolute/relative placement is the parent card’s responsibility (passed via
styleif needed). - Does not handle pointer or keyboard interaction —
pointerEvents: 'none'andaria-hiddenmark it as purely decorative. - Does not animate, transition, or react to hover/focus.
- Does not load fonts; relies on
'Cal Sans'being available withImpact, sans-serifas fallback.
Signals
- Visual signal only: rarity tier is encoded by
fillcolor andletterglyph. aria-hiddenremoves the badge from the accessibility tree, so screen readers ignore it; the rarity must be conveyed elsewhere in the card.
Entry points
- Named export
RarityBadge({ letter, fill, radius, style })consumed by rarity-card components insrc/metagame/.
Pattern notes
- Inline-style component with no CSS module or stylesheet dependency — keeps the badge self-contained and themable per call site.
- Letter stroke is faked with a four-direction
text-shadow(-1/+1pxon each axis) rather than an SVG stroke, avoiding a nested SVG element. - Geometry is fully derived from
radius: width/height equalradius * 2, font size isround(radius * 1.05), so a single prop scales the entire badge. - Border is
1px solid rgba(0,0,0,0.7)with a0 1px 0 rgba(0,0,0,0.45)box-shadow for a subtle lift against the card. borderRadius: '50%'plus equal width/height yields the circular shape; flexbox centers the letter.- Caller-supplied
styleis spread last, so callers can override any computed property (e.g., positioning, transform, z-index).