Files
Genarrative/src/components/common/CopyFeedbackMessage.tsx
T
kdletters 071faa482c 统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口

完成项目 TypeScript/Prettier 与 Rust 全量格式化

修复 Pingora expected executable 门禁的空白敏感误报

同步开发运维文档与 AGC skill pack 格式化忽略规则
2026-09-01 16:28:34 +08:00

32 lines
733 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>
);
}