fix: stabilize artifact card title row

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-06-05 22:24:32 +00:00
1 parent 2b62cebf57
commit ee5e6d4135
2 files changed
+25 -2

No files matched your search

@@ -52,6 +52,8 @@ describe("ArtifactCard", () => {
expect(markup).toContain('src="/files/art-1.png"');
expect(markup).toContain("object-cover");
expect(markup).toContain("Hero shot");
expect(markup).toContain("flex h-7 items-start justify-between gap-2");
expect(markup).toContain("leading-7");
expect(markup).toContain("Last edited Jun 1, 2026");
expect(markup).not.toContain("Landing visuals");
expect(markup).not.toContain("Edited ");
@@ -142,4 +144,22 @@ describe("ArtifactCard", () => {
expect(markup).not.toContain('aria-label="Download file"');
expect(markup).not.toContain('aria-label="Open file in new tab"');
});
it("reserves the same title row height when file actions are absent", () => {
const markup = renderToStaticMarkup(
<ArtifactCard
artifact={makeArtifact({
openPath: null,
downloadPath: null,
createdByAgent: null,
})}
/>,
);
expect(markup).toContain("flex h-7 items-start justify-between gap-2");
expect(markup).toContain("leading-7");
expect(markup).toContain("Last edited Jun 1, 2026");
expect(markup).not.toContain('aria-label="Download file"');
expect(markup).not.toContain('aria-label="Open file in new tab"');
});
});
+5 -2
View File
@@ -151,8 +151,11 @@ export function ArtifactCard({ artifact }: ArtifactCardProps) {
<ArtifactPreview artifact={artifact} />
<div className="flex flex-1 flex-col gap-1 p-3">
<div className="flex items-start justify-between gap-2">
<h3 className="truncate text-sm font-medium text-foreground/85" title={artifact.title}>
<div className="flex h-7 items-start justify-between gap-2">
<h3
className="min-w-0 flex-1 truncate text-sm font-medium leading-7 text-foreground/85"
title={artifact.title}
>
{artifact.title}
</h3>
<div className="flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100">