Files
Genarrative/src/components/common/PlatformInlineOptionButton.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

43 lines
1.3 KiB
TypeScript

import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from 'react';
type PlatformInlineOptionButtonProps = Omit<
ButtonHTMLAttributes<HTMLButtonElement>,
'children'
> & {
children: ReactNode;
trailingIcon?: ReactNode;
};
/**
* 平台内联选项按钮。
* 统一承接工具面板里“当前选项 + 下拉箭头”这类轻量 pill 动作。
*/
export const PlatformInlineOptionButton = forwardRef<
HTMLButtonElement,
PlatformInlineOptionButtonProps
>(function PlatformInlineOptionButton(
{ children, trailingIcon, className, type = 'button', ...buttonProps },
ref,
) {
const actionClassName = [
'platform-inline-option-button inline-flex items-center justify-center border-0 bg-transparent text-sm font-black text-slate-700 transition-colors hover:text-slate-950 disabled:cursor-not-allowed disabled:opacity-55',
className,
]
.filter(Boolean)
.join(' ');
return (
<button {...buttonProps} ref={ref} type={type} className={actionClassName}>
<span className="platform-inline-option-button__label">{children}</span>
{trailingIcon ? (
<span
className="platform-inline-option-button__trailing"
aria-hidden="true"
>
{trailingIcon}
</span>
) : null}
</button>
);
});