fix: passing on fill property to fallback image to support text as overlay with position absolute
Approved-by: Bianca Widstam
This commit is contained in:
@@ -45,7 +45,7 @@ export default function Image({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!src || imageError) {
|
if (!src || imageError) {
|
||||||
return <ImageFallback />
|
return <ImageFallback fill={props.fill} />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -7,4 +7,8 @@
|
|||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
min-height: 200px;
|
min-height: 200px;
|
||||||
background-color: var(--Surface-Feedback-Neutral-light);
|
background-color: var(--Surface-Feedback-Neutral-light);
|
||||||
|
|
||||||
|
&.fill {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,20 @@ import styles from "./imageFallback.module.css"
|
|||||||
interface ImageFallbackProps extends React.HTMLAttributes<HTMLDivElement> {
|
interface ImageFallbackProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
width?: string
|
width?: string
|
||||||
height?: string
|
height?: string
|
||||||
|
fill?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ImageFallback({
|
export default function ImageFallback({
|
||||||
width = "100%",
|
width = "100%",
|
||||||
height = "100%",
|
height = "100%",
|
||||||
className,
|
className,
|
||||||
|
fill = false,
|
||||||
...props
|
...props
|
||||||
}: ImageFallbackProps) {
|
}: ImageFallbackProps) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
{...props}
|
{...props}
|
||||||
className={cx(styles.imageFallback, className)}
|
className={cx(styles.imageFallback, className, { [styles.fill]: fill })}
|
||||||
style={{ width, height }}
|
style={{ width, height }}
|
||||||
>
|
>
|
||||||
<MaterialIcon
|
<MaterialIcon
|
||||||
|
|||||||
Reference in New Issue
Block a user