Add height width on Image component

pull/8454/head
Puru Vijay 3 years ago
parent 4365c34b4a
commit d4a7097312

@ -62,13 +62,11 @@
<Supporters />
<div style="aspect-ratio: 4490 / 990;">
{#if $theme.current === 'light'}
<Image src={BallsLight} alt="The Svelte logo in a ball pit" />
{:else}
<Image src={BallsDark} alt="The Svelte logo in a ball pit" />
{/if}
</div>
<footer>
<a href="/tutorial">Tutorial</a>

@ -4,13 +4,15 @@
/** @type {string} */
export let alt;
console.log(src);
</script>
<picture>
{#each Object.entries(src?.sources ?? {}) as [format, images]}
<source srcset={images?.map((i) => `${i?.src} ${i?.w}w`).join(', ')} type="image/{format}" />
{/each}
<img src={src?.img?.src} {alt} />
<img height={src.img.h} width={src.img.w} src={src?.img?.src} {alt} />
</picture>
<style>

Loading…
Cancel
Save