frontend / 6.0.0-dev.6 /atoms /src /DownloadLink.svelte
gradio-pr-bot's picture
Upload folder using huggingface_hub
58d8017 verified
raw
history blame
825 Bytes
<script lang="ts">
import type { HTMLAnchorAttributes } from "svelte/elements";
import { createEventDispatcher } from "svelte";
interface DownloadLinkAttributes
extends Omit<HTMLAnchorAttributes, "target"> {
download: NonNullable<HTMLAnchorAttributes["download"]>;
}
type $$Props = DownloadLinkAttributes;
export let href: DownloadLinkAttributes["href"] = undefined;
export let download: DownloadLinkAttributes["download"];
const dispatch = createEventDispatcher();
</script>
<a
style:position="relative"
class="download-link"
{href}
target={typeof window !== "undefined" && window.__is_colab__
? "_blank"
: null}
rel="noopener noreferrer"
{download}
{...$$restProps}
on:click={dispatch.bind(null, "click")}
>
<slot />
</a>
<style>
.unstyled-link {
all: unset;
cursor: pointer;
}
</style>