Skip to content

Commit e607e53

Browse files
dancormierclaude
andcommitted
feat(docs-next): replace copy-to-markdown button with copy-link icon in breadcrumb
Removes the "Copy" button from the page actions row and adds a small link icon button (s-btn__xs s-btn__clear s-btn__icon) inline at the end of the breadcrumb nav. Clicking it copies the current page URL to the clipboard using the existing copyToClipboard action. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dc7cee6 commit e607e53

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

  • packages/stacks-docs-next/src/routes/[category]/[[section]]/[subsection]

packages/stacks-docs-next/src/routes/[category]/[[section]]/[subsection]/+page.svelte

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script lang="ts">
2-
import { IconServiceGitHub, IconServiceFigma, IconServiceSvelte, IconCheckFillCircle, IconStackCards } from '@stackoverflow/stacks-icons/icons';
2+
import { IconServiceGitHub, IconServiceFigma, IconServiceSvelte, IconCheckFillCircle, IconLink } from '@stackoverflow/stacks-icons/icons';
33
import { Icon, Button } from '@stackoverflow/stacks-svelte';
44
import { resolve } from '$app/paths';
5+
import { page } from '$app/state';
56

67
import { copyToClipboard } from '$src/lib/copyToClipboard';
78
import Contents from '$components/Contents.svelte';
89

910
let { data } = $props();
10-
let copiedMd = $state(false);
11+
let copied = $state(false);
1112

1213
const toc = $derived(data?.metadata?.toc || []);
1314

@@ -21,11 +22,8 @@
2122
const pageDescription = $derived(data?.metadata?.description || `Documentation for ${data.active.title} in the Stack Overflow Design System`);
2223

2324
function copySuccess() {
24-
copiedMd = true
25-
26-
setTimeout(() => {
27-
copiedMd = false;
28-
}, 2000);
25+
copied = true;
26+
setTimeout(() => { copied = false; }, 2000);
2927
}
3028
</script>
3129

@@ -50,18 +48,15 @@
5048
{#each data.breadcrumb as crumb, index (crumb.path)}
5149
<a href={resolve(crumb.path)} class="pr6 s-link">{crumb.label}</a>{#if index !== data.breadcrumb.length - 1}<span class="fc-black-300 mr6">/</span>{/if}
5250
{/each}
51+
<button type="button" title="Copy link to this page" class="s-btn s-btn__xs s-btn__clear s-btn__icon ml4" use:copyToClipboard={page.url.href}>
52+
{#if copied}
53+
<Icon src={IconCheckFillCircle} class="fc-green-400" />
54+
{:else}
55+
<Icon src={IconLink} />
56+
{/if}
57+
</button>
5358
</nav>
5459

55-
<button type="button" title="Copy to Markdown" class="s-btn s-btn__sm s-btn__clear s-btn__icon" use:copyToClipboard={data.markdown}>
56-
{#if copiedMd}
57-
<Icon src={IconCheckFillCircle} class="fc-green-400" />
58-
<span class="sm:d-none">Copied!</span>
59-
{:else}
60-
<Icon src={IconStackCards} />
61-
<span class="sm:d-none">Copy</span>
62-
{/if}
63-
</button>
64-
6560
{#if data.filename}
6661
<Button title="Edit on GitHub" size="sm" weight="clear" href={`https://github.com/StackExchange/Stacks/edit/main/packages/stacks-docs-next${data.filename}`} class="flex--item">
6762
<Icon src={IconServiceGitHub} />

0 commit comments

Comments
 (0)