d3ro-voice/packages/ui-native/src/components/Led.tsx
Yun Chan 660e622a93 refactor(ui-native): d3roNativePalette amber->main 개명 (WS-NATIVE)
- packages/ui-native theme.ts accent: amber->main, amberDim->dim, amberGlow->glow (값 보존)
- apps/mobile 20건 + apps/mobile-rn 18건 + ui-native 컴포넌트 9건 = 47 참조 치환
SKIP: Led/PhosphorText/Header color prop 'amber'(의미론적 컴포넌트 API, 별도 마이그레이션)
       green/greenGlow 키(amber계 범위外)
정책: docs/REFACTOR_POLICY.md DP1, 이식 인사이트 P7
2026-07-22 02:37:45 +09:00

35 lines
1 KiB
TypeScript

// packages/ui-native/src/components/Led.tsx
// RN용 Led — 작은 발광 원
import { View, type ViewStyle } from 'react-native'
import { d3roNativePalette } from '../theme'
export interface LedProps {
color?: 'amber' | 'green' | 'red' | 'orange' | 'blue'
on?: boolean
size?: number
}
const COLOR_MAP: Record<string, string> = {
amber: d3roNativePalette.accent.main,
green: d3roNativePalette.tag.green,
red: d3roNativePalette.tag.red,
orange: d3roNativePalette.tag.orange,
blue: d3roNativePalette.tag.blue
}
export function Led({ color = 'amber', on = true, size = 8 }: LedProps): React.ReactElement {
const c = COLOR_MAP[color] ?? d3roNativePalette.accent.main
const style: ViewStyle = {
width: size,
height: size,
borderRadius: size / 2,
backgroundColor: on ? c : d3roNativePalette.led.off,
shadowColor: c,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: on ? 0.8 : 0,
shadowRadius: on ? 4 : 0,
elevation: on ? 2 : 0
}
return <View style={style} />
}