link: refactor href rewrite
- uses prop instead of attempting to read env variable - uses URL type instead of custom heuristics
This commit is contained in:
@@ -476,6 +476,23 @@
|
||||
{/snippet}
|
||||
</div>
|
||||
|
||||
<!-- Link with href rewriting -->
|
||||
<div class="component">
|
||||
<p class="title">Link (with href rewriting)</p>
|
||||
|
||||
<p class="mb-3">
|
||||
href rewriting allows you to prepend a basepath to relative links, making it easier to manage
|
||||
URLs in your application. It is recommended to wrap this element with your own, e.g. AppLink,
|
||||
that automatically provides the basepath from your app's configuration.
|
||||
</p>
|
||||
|
||||
<div class="flex flex-col gap-3">
|
||||
<Link href="/about" basepath="/sui-demo">Go to About Page (with basepath)</Link>
|
||||
<Link href="https://svelte.dev" basepath="/sui-demo">External Svelte Site</Link>
|
||||
<Link href="contact">Contact Us (relative link, no basepath)</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Regular Dialog Demo -->
|
||||
<Dialog
|
||||
bind:open={dialogOpen}
|
||||
|
||||
Reference in New Issue
Block a user