fix images not rendering
This commit is contained in:
2 files changed
+18
-1
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
default: patch
|
||||
---
|
||||
|
||||
Fix images without explicit dimensions not appearing.
|
||||
@@ -65,6 +65,7 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
(
|
||||
{
|
||||
className,
|
||||
style,
|
||||
body,
|
||||
mimeType,
|
||||
url,
|
||||
@@ -122,9 +123,15 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
if (autoPlay) loadSrc();
|
||||
}, [autoPlay, loadSrc]);
|
||||
|
||||
const hasDimensions = typeof info?.w === 'number' && typeof info?.h === 'number';
|
||||
|
||||
return (
|
||||
<Box
|
||||
className={classNames(css.RelativeBase, className)}
|
||||
style={{
|
||||
...(hasDimensions ? { aspectRatio: `${info.w} / ${info.h}` } : { minHeight: '150px' }),
|
||||
...style,
|
||||
}}
|
||||
{...props}
|
||||
ref={ref}
|
||||
onPointerEnter={() => setIsHovered(true)}
|
||||
@@ -185,7 +192,12 @@ export const ImageContent = as<'div', ImageContentProps>(
|
||||
</Box>
|
||||
)}
|
||||
{srcState.status === AsyncStatus.Success && (
|
||||
<Box className={classNames(css.AbsoluteContainer, blurred && css.Blur)}>
|
||||
<Box
|
||||
className={classNames(
|
||||
hasDimensions ? css.AbsoluteContainer : undefined,
|
||||
blurred && css.Blur
|
||||
)}
|
||||
>
|
||||
{renderImage({
|
||||
alt: body,
|
||||
title: body,
|
||||
|
||||
Reference in new issue
Block a user