import {codeWarning} from '@befe/brick-utils' import {ButtonProps} from './base' const DEPRECATED_COLOR_MAP: Record = { 'error': 'danger', 'primary': 'brand', } export function normalizeColor(color?: string): ButtonProps['color'] { const normalizedColor = color && DEPRECATED_COLOR_MAP[color] as ButtonProps['color'] codeWarning( // primary 暂不提示 !normalizedColor || color === 'primary', `[Button] color '${color}' has been deprecated, use color '${normalizedColor}' instead.` ) return normalizedColor || color as ButtonProps['color'] }