1
0

Добавлен компонент Picture

This commit is contained in:
2025-09-11 15:07:04 +04:00
parent a73c89e59b
commit ead47ea291
2 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
{#if src}
<picture>
{#if src?.sources}
{#each Object.entries(src.sources) as [ format, srcset ]}
<source {srcset} type={`image/${format}`}/>
{/each}
{/if}
<Image
src={src?.img?.src || src}
width={src?.img?.w}
height={src?.img?.h}
{...others}
/>
</picture>
{/if}
<script>
import { Image } from './Image.svelte'
let {
src,
...others
} = $props()
</script>
<style lang="scss">
picture {
display: flex;
width: 100%;
height: 100%;
}
</style>

View File

@@ -1 +1,2 @@
export { default as Image } from './components/Image.svelte'
export { default as Image } from './components/Image.svelte'
export { default as Picture } from './components/Picture.svelte'