mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix(ideal-image): do not pass down img
prop (#8250)
This commit is contained in:
parent
e301523138
commit
258ecf71f1
1 changed files with 4 additions and 10 deletions
|
@ -81,25 +81,19 @@ function getMessage(icon: IconKey, state: State) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function IdealImage(props: Props): JSX.Element {
|
export default function IdealImage(props: Props): JSX.Element {
|
||||||
const {alt, className, img} = props;
|
const {img, ...propsRest} = props;
|
||||||
|
|
||||||
// In dev env just use regular img with original file
|
// In dev env just use regular img with original file
|
||||||
if (typeof img === 'string' || 'default' in img) {
|
if (typeof img === 'string' || 'default' in img) {
|
||||||
return (
|
return (
|
||||||
<img
|
// eslint-disable-next-line jsx-a11y/alt-text
|
||||||
src={typeof img === 'string' ? img : img.default}
|
<img src={typeof img === 'string' ? img : img.default} {...propsRest} />
|
||||||
className={className}
|
|
||||||
alt={alt}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactIdealImage
|
<ReactIdealImage
|
||||||
{...props}
|
{...propsRest}
|
||||||
alt={alt}
|
|
||||||
className={className}
|
|
||||||
height={img.src.height ?? 100}
|
height={img.src.height ?? 100}
|
||||||
width={img.src.width ?? 100}
|
width={img.src.width ?? 100}
|
||||||
placeholder={{lqip: img.preSrc}}
|
placeholder={{lqip: img.preSrc}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue