svelte and nx rewrite
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { getFileAsset } from '@sanity/asset-utils';
|
||||
import { Download } from '@lucide/svelte';
|
||||
import { client } from '$lib/sanity';
|
||||
|
||||
let { portableText } = $props();
|
||||
const { value } = portableText;
|
||||
const { projectId, dataset } = client.config();
|
||||
</script>
|
||||
|
||||
{#if value?.asset}
|
||||
{@const file = getFileAsset(value, { projectId, dataset })}
|
||||
<a href={file.url} download class="inline-flex items-center gap-2 text-primary hover:underline">
|
||||
<Download size={16} />
|
||||
{value.title || 'Download file'}
|
||||
</a>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user