c5200c7d45
## 变更内容 - 新增基于 shadcn open-code 模式的共享 UI canonical 组件、样式与导出。 - 新增 `/components` 共享组件展示页,并覆盖平台组件、Token、状态和移动端布局。 - 补齐平台展示页的筛选、排序、上传预览、标签、开关和异步状态交互。 - 修复排序导致预览主题变化、筛选弹窗误关闭和入口状态不更新的问题。 - 同步网站与客户端构建别名、依赖、路由测试和项目文档。 ## 验证 - `npm run test -- src/components/shared-components/SharedComponentsShowcasePage.test.tsx` - `npm run typecheck` - `npm run check:encoding` - `npm run build:raw` - `git diff --check` - pre-push 门禁通过 Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/202 Co-authored-by: kdletters <kdletters@qq.com> Co-committed-by: kdletters <kdletters@qq.com>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { ArrowLeft } from 'lucide-react';
|
|
import type { ButtonHTMLAttributes } from 'react';
|
|
|
|
import { PlatformActionButton } from './PlatformActionButton';
|
|
import type { PlatformActionButtonSurface } from './platformActionButtonModel';
|
|
|
|
export type PlatformBackActionButtonVariant = 'compact' | 'regular';
|
|
|
|
export type PlatformBackActionButtonProps = Omit<
|
|
ButtonHTMLAttributes<HTMLButtonElement>,
|
|
'children'
|
|
> & {
|
|
label?: string;
|
|
variant?: PlatformBackActionButtonVariant;
|
|
surface?: PlatformActionButtonSurface;
|
|
};
|
|
|
|
const VARIANT_CLASS: Record<PlatformBackActionButtonVariant, string> = {
|
|
compact: 'gap-1.5 py-1.5 text-[11px]',
|
|
regular: 'gap-2 py-2 text-sm',
|
|
};
|
|
|
|
const ICON_CLASS: Record<PlatformBackActionButtonVariant, string> = {
|
|
compact: 'h-3.5 w-3.5',
|
|
regular: 'h-4 w-4',
|
|
};
|
|
|
|
/**
|
|
* 平台轻量返回动作按钮。
|
|
* 统一结果页、工作台等白底场景里的“左箭头 + 返回文案”按钮骨架。
|
|
*/
|
|
export function PlatformBackActionButton({
|
|
label = '返回',
|
|
variant = 'compact',
|
|
surface = 'platform',
|
|
className,
|
|
...buttonProps
|
|
}: PlatformBackActionButtonProps) {
|
|
return (
|
|
<PlatformActionButton
|
|
{...buttonProps}
|
|
surface={surface}
|
|
tone="ghost"
|
|
size="xs"
|
|
className={['min-h-0 self-start', VARIANT_CLASS[variant], className]
|
|
.filter(Boolean)
|
|
.join(' ')}
|
|
>
|
|
<ArrowLeft className={ICON_CLASS[variant]} />
|
|
{label}
|
|
</PlatformActionButton>
|
|
);
|
|
}
|