import type { HTMLAttributes, ReactNode } from 'react'; import type { CopyFeedbackState } from './useCopyFeedback'; type CopyFeedbackMessageProps = Omit< HTMLAttributes, 'children' > & { state: CopyFeedbackState; copiedLabel?: ReactNode; failedLabel?: ReactNode; }; /** * 统一复制反馈提示。 * 非按钮区域只负责展示成功 / 失败,不在业务页重复写 copied / failed 分支。 */ export function CopyFeedbackMessage({ state, copiedLabel = '已复制', failedLabel = '复制失败', ...divProps }: CopyFeedbackMessageProps) { if (state === 'idle') { return null; } return
{state === 'copied' ? copiedLabel : failedLabel}
; }