preserve style attribute from images (#1587)

This commit is contained in:
Athou
2024-10-21 21:15:57 +02:00
parent b35513ea84
commit 8230fde5d2
4 changed files with 21 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ interface ImageWithPlaceholderWhileLoadingProps {
title?: string
width?: number
height?: number | "auto"
style?: React.CSSProperties
placeholderWidth?: number
placeholderHeight?: number
placeholderBackgroundColor?: string
@@ -42,6 +43,7 @@ export function ImageWithPlaceholderWhileLoading({
src,
title,
width,
style,
}: ImageWithPlaceholderWhileLoadingProps) {
const { classes } = useStyles({
placeholderWidth,
@@ -68,7 +70,7 @@ export function ImageWithPlaceholderWhileLoading({
width={width}
height={height}
onLoad={() => setLoading(false)}
style={{ display: loading ? "none" : "block" }}
style={{ ...style, display: loading ? "none" : (style?.display ?? "initial") }}
/>
</>
)