Adjust types for Image.svelte
This commit is contained in:
parent
72452acf2c
commit
4bced28e3e
1 changed files with 48 additions and 42 deletions
|
@ -13,9 +13,9 @@
|
|||
|
||||
let {
|
||||
image,
|
||||
tags = [],
|
||||
tags,
|
||||
class: className
|
||||
}: { image: EnhancedImage; tags: Tag[]; class: string } = $props();
|
||||
}: { image: EnhancedImage | undefined; tags?: Tag[]; class?: string } = $props();
|
||||
|
||||
let badgeVariant: BadgeVariant = $derived($mode == 'dark' ? 'secondary' : 'default');
|
||||
</script>
|
||||
|
@ -36,9 +36,10 @@
|
|||
</span>
|
||||
{/snippet}
|
||||
|
||||
<div
|
||||
{#if image}
|
||||
<div
|
||||
class="projectCardImage grid justify-items-center overflow-hidden rounded-md bg-primary shadow-lg"
|
||||
>
|
||||
>
|
||||
{#if typeof image.src === 'string'}
|
||||
<img src={image.src} alt={image.alt} class={className} />
|
||||
{:else}
|
||||
|
@ -76,12 +77,17 @@
|
|||
)}
|
||||
</a>
|
||||
{:else}
|
||||
{@render creditText(image.credit.author, image.credit.type, 'w-4 inline align-[-0.65em]')}
|
||||
{@render creditText(
|
||||
image.credit.author,
|
||||
image.credit.type,
|
||||
'w-4 inline align-[-0.65em]'
|
||||
)}
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.projectCardImage > * {
|
||||
|
|
Loading…
Add table
Reference in a new issue