This commit is contained in:
@@ -5,6 +5,7 @@ import { generateThumbHash } from "@helpers/image";
|
||||
interface Props {
|
||||
src: ImageMetadata;
|
||||
alt: string;
|
||||
pictureClass?: string;
|
||||
class?: string;
|
||||
caption?: string;
|
||||
hash?: boolean;
|
||||
@@ -12,7 +13,14 @@ interface Props {
|
||||
maxWidth?: number;
|
||||
}
|
||||
|
||||
const { src: image, loader = true, hash = true, alt, maxWidth } = Astro.props;
|
||||
const {
|
||||
src: image,
|
||||
loader = true,
|
||||
pictureClass = "",
|
||||
hash = true,
|
||||
alt,
|
||||
maxWidth,
|
||||
} = Astro.props;
|
||||
|
||||
let thumbhash = hash ? await generateThumbHash(image) : "";
|
||||
|
||||
@@ -40,7 +48,7 @@ const sizes = [
|
||||
alt={alt}
|
||||
data-thumbhash={thumbhash}
|
||||
pictureAttributes={{
|
||||
class: `${hash ? "block h-full relative" : ""} ${loader ? "thumb" : ""}`,
|
||||
class: `${hash ? "block h-full relative" : ""} ${loader ? "thumb" : ""} ${pictureClass}`,
|
||||
}}
|
||||
class={Astro.props.class}
|
||||
widths={sizes.map((size) => size.width)}
|
||||
|
Reference in New Issue
Block a user