Files
continuwuity/packages/website/src/lib/htmlComponents/img.svelte
T

44 lines
950 B
Svelte
Raw Normal View History

2024-07-16 20:24:04 +01:00
<script>
export let src;
export let alt;
2024-07-16 20:53:09 +01:00
export let title;
2024-07-16 21:50:00 +01:00
export let thumb;
2024-07-16 22:01:35 +01:00
// console.log("imgcmp", thumb);
2024-07-16 21:50:00 +01:00
let className = "";
2024-07-16 20:43:43 +01:00
export { className as class };
2024-07-16 20:24:04 +01:00
// console.log(src)
// import _PastedImage20240716123726Png from "./Pasted%20image%2020240716123726.png?meta";
2024-07-16 20:43:43 +01:00
</script>
2024-07-16 20:24:04 +01:00
2024-07-16 20:43:43 +01:00
<figure class={className}>
2024-07-16 21:50:00 +01:00
<img
{src}
{alt}
{title}
width={thumb?.originalWidth}
height={thumb?.originalHeight}
style:background-image="url('{thumb?.thumbSrc}')"
/>
2024-07-16 20:53:09 +01:00
{#if title}
<figcaption>{title}</figcaption>
2024-07-16 20:43:43 +01:00
{/if}
</figure>
<style>
img {
max-height: 60vh;
2024-07-16 21:50:00 +01:00
background-size: cover;
width: auto;
height: auto;
2024-07-16 20:43:43 +01:00
display: block;
margin-inline: auto;
}
figure {
text-align: center;
}
figcaption {
font-size: 0.95em;
2024-07-16 21:50:00 +01:00
margin-block: calc(var(--spacing) / 2);
2024-07-16 20:43:43 +01:00
}
</style>