Skip to content

Commit

Permalink
Fixed url to be reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
Not-Abram committed Oct 4, 2024
1 parent a2ff683 commit 684f850
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions packages/viewer/src/components/Shared/Cite.svelte
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
<script lang="ts">
import { onMount } from 'svelte'
import { page } from '$app/stores'
import CopyButton from './CopyButton.svelte'
let url = ''
let markdown = ''
export let title: string =
'π-Base, a community database of topological counterexamples.'
onMount(() => {
url = window.location.href
markdown = `[${title}](${url})`
})
$: markdown = `[${title}](${$page.url})`
</script>

{#key title}
<div class="text-center p-2">
<small>
Cite as:
<span class="text-muted">
The pi-Base Community.
<cite>{title}.</cite>
Available at: {url}
(Accessed: {new Date().toISOString().split('T')[0]}).
</span>
</small>
</div>
<div class="text-center p-2">
<small>
Copy:
<CopyButton text={markdown}>Markdown Link</CopyButton>
</small>
</div>
{/key}
<div class="text-center p-2">
<small>
Cite as:
<span class="text-muted">
The pi-Base Community.
<cite>{title}.</cite>
Available at: {$page.url}
(Accessed: {new Date().toISOString().split('T')[0]}).
</span>
</small>
</div>
<div class="text-center p-2">
<small>
Copy:
<CopyButton text={markdown}>Markdown Link</CopyButton>
</small>
</div>

0 comments on commit 684f850

Please sign in to comment.