feat: some shit
This commit is contained in:
@ -1,15 +1,18 @@
|
||||
---
|
||||
import type { ImageMetadata } from "astro";
|
||||
import { Image as AstroImage } from "astro:assets";
|
||||
import { Picture as AstroImage } from "astro:assets";
|
||||
interface Props {
|
||||
src: ImageMetadata;
|
||||
alt: string;
|
||||
class?: string;
|
||||
caption?: string;
|
||||
maxWidth?: number;
|
||||
}
|
||||
|
||||
const { src: image, alt, maxWidth } = Astro.props;
|
||||
|
||||
console.log({ image, alt, maxWidth });
|
||||
|
||||
const sizes = [
|
||||
{
|
||||
width: 240,
|
||||
@ -32,14 +35,9 @@ const sizes = [
|
||||
<AstroImage
|
||||
src={image}
|
||||
alt={alt}
|
||||
class={Astro.props.class}
|
||||
widths={sizes.map((size) => size.width)}
|
||||
sizes={sizes
|
||||
.map((size) => `${size.media || "100vw"} ${size.width}px`)
|
||||
.join(", ")}
|
||||
/>
|
||||
|
||||
<style>
|
||||
img {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user