Files
Genarrative/packages/shared/src/components/CanvasCardCornerActions.tsx
T
suzmii c329c438d9
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Has been cancelled
修复资源画布PR的CI回归(#410)
修复活动回合空快照引用及停用后晚到请求覆盖问题
对齐共享卡片角标与窗口发布次数回归断言
同步原生HTTP权限检查与图集显式切片测试契约
整理菜单组件导入顺序并记录本地验证范围
2026-09-17 20:17:26 +08:00

69 lines
1.8 KiB
TypeScript

import { Info } from 'lucide-react';
import type { CSSProperties, Ref } from 'react';
import { PlatformIconButton } from './PlatformIconButton';
/** 画布卡片共用的类型标签与信息入口,不承接资源业务状态。 */
export function CanvasCardCornerActions({
kindLabel,
kindAriaLabel,
kindClassName,
infoLabel,
style,
kindRef,
onKindClick,
onInfoClick,
infoPressed,
}: {
kindLabel?: string | null;
kindAriaLabel?: string;
kindClassName?: string;
infoLabel: string;
style?: CSSProperties;
kindRef?: Ref<HTMLSpanElement>;
onKindClick?: () => void;
onInfoClick: () => void;
infoPressed?: boolean;
}) {
return (
<span
className="shared-canvas-card-corners"
style={style}
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => event.stopPropagation()}
onKeyDown={(event) => event.stopPropagation()}
>
{kindLabel ? (
<span
ref={kindRef}
className={`shared-canvas-card-kind ${kindClassName ?? ''}`}
data-resource-type={kindLabel}
role={onKindClick ? 'button' : undefined}
tabIndex={onKindClick ? 0 : undefined}
aria-label={kindAriaLabel}
title={kindLabel}
onClick={onKindClick}
onKeyDown={(event) => {
if (onKindClick && (event.key === 'Enter' || event.key === ' ')) {
event.preventDefault();
onKindClick();
}
}}
>
{kindLabel}
</span>
) : null}
<PlatformIconButton
asChild="spanButton"
variant="darkMini"
className="shared-canvas-card-info"
label={infoLabel}
title="信息"
aria-pressed={infoPressed}
icon={<Info size={12} aria-hidden="true" />}
onClick={onInfoClick}
/>
</span>
);
}