收口作品详情图标按钮

将作品详情顶部返回和分享入口迁移到 PlatformIconButton

将作品详情封面轮播图标入口迁移到 PlatformIconButton

补充作品详情公共图标按钮断言

更新 PlatformUiKit 文档和 Hermes 决策记录
This commit is contained in:
2026-06-10 13:34:02 +08:00
parent 345ace1842
commit 7977a19d24
4 changed files with 33 additions and 25 deletions

View File

@@ -140,6 +140,12 @@ test('PlatformWorkDetailView renders compact stats and date time', () => {
expect(screen.getByText('2026-04-25')).toBeTruthy();
expect(screen.getAllByText('次')).toHaveLength(2);
expect(screen.getByText('赞')).toBeTruthy();
expect(screen.getByRole('button', { name: '返回' }).className).toContain(
'platform-icon-button',
);
expect(screen.getByRole('button', { name: '分享' }).className).toContain(
'platform-icon-button',
);
expect(screen.getByRole('button', { name: '点赞 4赞' })).toBeTruthy();
expect(screen.getByRole('button', { name: '作品改造' })).toBeTruthy();
expect(screen.getByRole('button', { name: '启动' })).toBeTruthy();
@@ -314,6 +320,12 @@ test('PlatformWorkDetailView cycles puzzle level cover slides', () => {
'.platform-work-detail__app-icon img',
);
expect(appIconImage?.getAttribute('src')).toBe('/level-1.png');
expect(
screen.getByRole('button', { name: '上一张关卡图' }).className,
).toContain('platform-icon-button');
expect(
screen.getByRole('button', { name: '下一张关卡图' }).className,
).toContain('platform-icon-button');
fireEvent.click(screen.getByRole('button', { name: '下一张关卡图' }));

View File

@@ -18,6 +18,7 @@ import type { PublicUserSummary } from '../../../packages/shared/src/contracts/a
import { buildPublicWorkDetailUrl } from '../../routing/appPageRoutes';
import { CopyCodeButton } from '../common/CopyCodeButton';
import { CopyFeedbackMessage } from '../common/CopyFeedbackMessage';
import { PlatformIconButton } from '../common/PlatformIconButton';
import { useCopyFeedback } from '../common/useCopyFeedback';
import { ResolvedAssetImage } from '../ResolvedAssetImage';
import {
@@ -252,26 +253,22 @@ export function PlatformWorkDetailView({
return (
<div className="platform-work-detail">
<div className="platform-work-detail__topbar">
<button
type="button"
<PlatformIconButton
label="返回"
className="platform-work-detail__icon-button"
onClick={onBack}
aria-label="返回"
title="返回"
>
<ArrowLeft className="h-6 w-6" />
</button>
icon={<ArrowLeft className="h-6 w-6" />}
/>
<div className="platform-work-detail__title"></div>
<button
type="button"
<PlatformIconButton
label="分享"
className="platform-work-detail__icon-button"
onClick={sharePublicWork}
disabled={!publicWorkCode}
aria-label="分享"
title="分享"
>
<Share2 className="h-5 w-5" />
</button>
icon={<Share2 className="h-5 w-5" />}
/>
</div>
<div className="platform-work-detail__scroll">
@@ -303,24 +300,20 @@ export function PlatformWorkDetailView({
) : null}
{hasCoverCarousel ? (
<>
<button
type="button"
<PlatformIconButton
label="上一张关卡图"
className="platform-work-detail__cover-nav platform-work-detail__cover-nav--prev"
onClick={showPreviousCover}
aria-label="上一张关卡图"
title="上一张关卡图"
>
<ChevronLeft className="h-5 w-5" />
</button>
<button
type="button"
icon={<ChevronLeft className="h-5 w-5" />}
/>
<PlatformIconButton
label="下一张关卡图"
className="platform-work-detail__cover-nav platform-work-detail__cover-nav--next"
onClick={showNextCover}
aria-label="下一张关卡图"
title="下一张关卡图"
>
<ChevronRight className="h-5 w-5" />
</button>
icon={<ChevronRight className="h-5 w-5" />}
/>
<div className="platform-work-detail__cover-dots">
{coverSlides.map((slide, index) => (
<button