'use client' /** * LobsterLoading — 小龍蝦載入動畫 * ================================= * Sprint 5: 所有「載入中」用小龍蝦動畫取代純文字 * 設計: Q版龍蝦上下浮動 + 文字提示 * * 建立時間: 2026-04-08 (台北時區) */ import { useTranslations } from 'next-intl' // ============================================================================= // OpenClaw 風格龍蝦 SVG (參考 dashboardicons.com/icons/openclaw) // 圓潤可愛風格 + 三色版本: red(預設/異常) / green(健康) / yellow(警告) // ============================================================================= type LobsterColor = 'red' | 'green' | 'yellow' const COLOR_MAP: Record = { red: { body: '#ef0011', dark: '#8a000a', eye: '#0b0303' }, green: { body: '#22C55E', dark: '#15803d', eye: '#0b0303' }, yellow: { body: '#F59E0B', dark: '#b45309', eye: '#0b0303' }, } /** OpenClaw 風格可愛龍蝦 SVG */ export function OpenClawLobster({ size = 36, color = 'red' }: { size?: number; color?: LobsterColor }) { const c = COLOR_MAP[color] return ( {/* 身體 (圓潤橢圓) */} {/* 頭 (大圓) */} {/* 肚子高光 */} {/* 眼睛 (大圓白底 + 黑瞳) */} {/* 眼睛高光 */} {/* 左鉗 */} {/* 右鉗 */} {/* 觸角 */} {/* 嘴巴 (微笑) */} {/* 腳 */} ) } // ============================================================================= // Loading 元件 // ============================================================================= interface LobsterLoadingProps { text?: string size?: 'sm' | 'md' | 'lg' color?: LobsterColor } const SIZES = { sm: { svg: 28, bob: 2, fontSize: 11 }, md: { svg: 40, bob: 3, fontSize: 12 }, lg: { svg: 56, bob: 4, fontSize: 13 }, } export function LobsterLoading({ text, size = 'md', color = 'red' }: LobsterLoadingProps) { const tc = useTranslations('common') const s = SIZES[size] const displayText = text ?? tc('loading') return (
{displayText}
) } export default LobsterLoading