Only include placeholder in DOM when necessary
This commit is contained in:
parent
e9ae3de00f
commit
e4f8c09c32
1 changed files with 9 additions and 8 deletions
|
@ -276,15 +276,16 @@ export default class extends React.Component {
|
||||||
{ /* Calculate aspect ratio, using %padding will size _container correctly */ }
|
{ /* Calculate aspect ratio, using %padding will size _container correctly */ }
|
||||||
<div style={{ paddingBottom: (100 * content.info.h / content.info.w) + '%' }}></div>
|
<div style={{ paddingBottom: (100 * content.info.h / content.info.w) + '%' }}></div>
|
||||||
|
|
||||||
<div className="mx_MImageBody_thumbnail" style={{
|
{ showPlaceholder &&
|
||||||
"display": showPlaceholder ? undefined : 'none',
|
<div className="mx_MImageBody_thumbnail" style={{
|
||||||
// Constrain width here so that spinner appears central to the loaded thumbnail
|
// Constrain width here so that spinner appears central to the loaded thumbnail
|
||||||
"max-width": content.info.w + "px",
|
"max-width": content.info.w + "px",
|
||||||
}}>
|
}}>
|
||||||
<div className="mx_MImageBody_thumbnail_spinner">
|
<div className="mx_MImageBody_thumbnail_spinner">
|
||||||
{ placeholder }
|
{ placeholder }
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
|
||||||
<div style={{display: !showPlaceholder ? undefined : 'none'}}>
|
<div style={{display: !showPlaceholder ? undefined : 'none'}}>
|
||||||
{ img }
|
{ img }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue