diff --git a/web/src/lib/components/repo/CommitView.stories.svelte b/web/src/lib/components/repo/CommitView.stories.svelte index 3d2e2cb90..f100809ec 100644 --- a/web/src/lib/components/repo/CommitView.stories.svelte +++ b/web/src/lib/components/repo/CommitView.stories.svelte @@ -80,7 +80,7 @@ await expect(canvas.getByText("co-author")).toBeVisible(); await expect(canvas.getByText("committer")).toBeVisible(); - await expect(canvas.getByRole("link", { name: ".patch" })).toHaveAttribute( + await expect(canvas.getByRole("link", { name: "Download patch" })).toHaveAttribute( "href", "/dawn/tangled/commit/0123456789abcdef0123456789abcdef01234567.patch" ); @@ -96,8 +96,8 @@ const hidesDownloadsForShortRef = async ({ canvas }: PlayContext) => { await expect(canvas.getByText("add a storybook fixture")).toBeVisible(); - await expect(canvas.queryByRole("link", { name: ".patch" })).toBeNull(); - await expect(canvas.queryByRole("link", { name: ".diff" })).toBeNull(); + await expect(canvas.queryByRole("link", { name: "Download patch" })).toBeNull(); + await expect(canvas.queryByRole("link", { name: "Download diff" })).toBeNull(); }; const { Story } = defineMeta({ diff --git a/web/src/lib/components/repo/DiffCardChrome.svelte b/web/src/lib/components/repo/DiffCardChrome.svelte new file mode 100644 index 000000000..cc378489f --- /dev/null +++ b/web/src/lib/components/repo/DiffCardChrome.svelte @@ -0,0 +1,67 @@ + + + + +
+ +
+
+ {#if open} +
+ {#if actions} +
+ {@render actions()} +
+ {/if} +
+
+ +
+ {@render body()} +
+
diff --git a/web/src/lib/components/repo/DiffFileCard.svelte b/web/src/lib/components/repo/DiffFileCard.svelte index f90c791af..198c677ff 100644 --- a/web/src/lib/components/repo/DiffFileCard.svelte +++ b/web/src/lib/components/repo/DiffFileCard.svelte @@ -1,12 +1,12 @@ - -
- -
-
- {#if open} - - {:else} - - {/if} - - -
- {#if file.name.old && file.name.new && file.name.old !== file.name.new} - {file.name.old} - - {file.name.new} - {:else} - {name} - {/if} -
-
-
- {#if blobUrl} - - {/if} - {@render headerActions?.(file)} -
+ + {#snippet header()} + +
+ {#if file.name.old && file.name.new && file.name.old !== file.name.new} + {file.name.old} + + {file.name.new} + {:else} + {name} + {/if}
-
+ {/snippet} + + {#snippet actions()} + {#if blobUrl} + + {/if} + {@render headerActions?.(file)} + {/snippet} - {#if file.is_binary} -

- This is a binary file and will not be displayed. -

- {:else} - - {/if} -
+ {#snippet body()} + {#if file.is_binary} + + {:else} + + {/if} + {/snippet} + diff --git a/web/src/lib/components/repo/DiffFileList.svelte b/web/src/lib/components/repo/DiffFileList.svelte deleted file mode 100644 index faef388b9..000000000 --- a/web/src/lib/components/repo/DiffFileList.svelte +++ /dev/null @@ -1,84 +0,0 @@ - - - - -{#snippet nodes(list: TreeNode[])} - {#each list as node (`${node.type}:${node.name}`)} - {#if node.type === "dir"} -
- - - - - -
- {@render nodes(node.children)} -
-
- {:else} - - {/if} - {/each} -{/snippet} - -{@render nodes(tree)} diff --git a/web/src/lib/components/repo/DiffFileList.stories.svelte b/web/src/lib/components/repo/DiffFileTree.stories.svelte similarity index 93% rename from web/src/lib/components/repo/DiffFileList.stories.svelte rename to web/src/lib/components/repo/DiffFileTree.stories.svelte index 4c67508a6..90abedbcd 100644 --- a/web/src/lib/components/repo/DiffFileList.stories.svelte +++ b/web/src/lib/components/repo/DiffFileTree.stories.svelte @@ -1,7 +1,7 @@ {#snippet nodes(list: TreeNode[])} @@ -63,28 +80,24 @@ {#if node.type === "dir"} {@const open = !closed[node.path]}
(closed[node.path] = !e.currentTarget.open)}> - - + + {#if open} - -
+
{@render nodes(node.children)}
{:else} -
-