Simplified how the images are loaded from markdown
This commit is contained in:
parent
ae7dc03821
commit
7dc8ab3a28
@ -251,7 +251,7 @@ export default function Markdawn(props: Props): JSX.Element {
|
|||||||
name?: string;
|
name?: string;
|
||||||
}) => (
|
}) => (
|
||||||
<div
|
<div
|
||||||
className="my-8 cursor-pointer"
|
className="my-8 cursor-pointer place-content-center grid"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLightboxOpen(true);
|
setLightboxOpen(true);
|
||||||
setLightboxImages([
|
setLightboxImages([
|
||||||
@ -262,29 +262,16 @@ export default function Markdawn(props: Props): JSX.Element {
|
|||||||
setLightboxIndex(0);
|
setLightboxIndex(0);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{compProps.src.startsWith("/uploads/") ? (
|
<Img
|
||||||
<div className="relative w-full aspect-video">
|
image={
|
||||||
<Img
|
compProps.src.startsWith("/uploads/")
|
||||||
image={{
|
? getAssetURL(compProps.src, ImageQuality.Small)
|
||||||
__typename: "UploadFile",
|
: compProps.src
|
||||||
alternativeText: compProps.alt,
|
}
|
||||||
url: compProps.src,
|
layout="fill"
|
||||||
width: compProps.width ?? 1500,
|
objectFit="contain"
|
||||||
height: compProps.height ?? 1000,
|
quality={ImageQuality.Medium}
|
||||||
caption: compProps.caption ?? "",
|
></Img>
|
||||||
name: compProps.name ?? "",
|
|
||||||
}}
|
|
||||||
layout="fill"
|
|
||||||
objectFit="contain"
|
|
||||||
quality={ImageQuality.Medium}
|
|
||||||
></Img>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="grid place-content-center">
|
|
||||||
{/* eslint-disable-next-line jsx-a11y/alt-text */}
|
|
||||||
<img {...compProps} className="max-h-[50vh] " />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user