Add height width on Image component

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

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

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

Loading…
Cancel
Save