Skip to content

Commit

Permalink
Fixed example
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickG committed Jan 11, 2024
1 parent 5e55a9f commit d49f5cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/routes/readme/7/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
<div class="card--actions">
<a class="btn" href="#whatever">Call to action</a>
<a class="btn" href="/readme">Call to action</a>
</div>
</div>
`;
Expand Down
5 changes: 4 additions & 1 deletion src/routes/readme/7/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<script lang="ts">
import { base } from '$app/paths';
import type { HTMLButtonAttributes } from 'svelte/elements';
export let href: string | undefined = undefined;
export let type: HTMLButtonAttributes['type'] = 'button';
</script>

{#if href}
<a {...$$restProps} {href}><slot /></a>
<a {...$$restProps} href={href?.startsWith('/') ? base + href : href}
><slot /></a
>
{:else}
<button {...$$restProps} {type}><slot /></button>
{/if}

0 comments on commit d49f5cc

Please sign in to comment.