1ad25e30f8
新增 PlatformUiKit 通用弹窗、按钮、状态、空态、媒体、表单和标签等公共组件 迁移结果页、创作工作台、认证入口、RPG 暗色面板和运行态弹窗的重复 UI chrome 补充组件测试、页面回归测试、技术文档和 Hermes 共享决策记录
30 lines
723 B
TypeScript
30 lines
723 B
TypeScript
import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
|
import type { CopyFeedbackState } from './useCopyFeedback';
|
|
|
|
type CopyFeedbackMessageProps = Omit<
|
|
HTMLAttributes<HTMLDivElement>,
|
|
'children'
|
|
> & {
|
|
state: CopyFeedbackState;
|
|
copiedLabel?: ReactNode;
|
|
failedLabel?: ReactNode;
|
|
};
|
|
|
|
/**
|
|
* 统一复制反馈提示。
|
|
* 非按钮区域只负责展示成功 / 失败,不在业务页重复写 copied / failed 分支。
|
|
*/
|
|
export function CopyFeedbackMessage({
|
|
state,
|
|
copiedLabel = '已复制',
|
|
failedLabel = '复制失败',
|
|
...divProps
|
|
}: CopyFeedbackMessageProps) {
|
|
if (state === 'idle') {
|
|
return null;
|
|
}
|
|
|
|
return <div {...divProps}>{state === 'copied' ? copiedLabel : failedLabel}</div>;
|
|
}
|