web/SectionHeading: added a new prop to disable the link

This commit is contained in:
wukko 2024-12-19 21:09:51 +06:00
parent 8c9f7ff36d
commit 06000cbc77
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -8,6 +8,7 @@
export let title: string; export let title: string;
export let sectionId: string; export let sectionId: string;
export let beta = false; export let beta = false;
export let nolink = false;
export let copyData = ""; export let copyData = "";
const sectionURL = `${$page.url.origin}${$page.url.pathname}#${sectionId}`; const sectionURL = `${$page.url.origin}${$page.url.pathname}#${sectionId}`;
@ -32,18 +33,20 @@
</div> </div>
{/if} {/if}
<button {#if !nolink}
class="link-copy" <button
aria-label={copied class="link-copy"
? $t("button.copied") aria-label={copied
: $t(`button.copy${copyData ? "" : ".section"}`)} ? $t("button.copied")
on:click={() => { : $t(`button.copy${copyData ? "" : ".section"}`)}
copied = true; on:click={() => {
copyURL(copyData || sectionURL); copied = true;
}} copyURL(copyData || sectionURL);
> }}
<CopyIcon check={copied} regularIcon={!!copyData} /> >
</button> <CopyIcon check={copied} regularIcon={!!copyData} />
</button>
{/if}
</div> </div>
<style> <style>