Change media elements to use aspect-ratio rather than compute height themselves (#24686)
This commit is contained in:
		
					parent
					
						
							
								1eb51bd749
							
						
					
				
			
			
				commit
				
					
						598e63dad2
					
				
			
		
					 7 changed files with 40 additions and 136 deletions
				
			
		|  | @ -313,7 +313,7 @@ class MediaGallery extends React.PureComponent { | |||
|   } | ||||
| 
 | ||||
|   render () { | ||||
|     const { media, lang, intl, sensitive, height, defaultWidth, standalone, autoplay } = this.props; | ||||
|     const { media, lang, intl, sensitive, defaultWidth, standalone, autoplay } = this.props; | ||||
|     const { visible } = this.state; | ||||
|     const width = this.state.width || defaultWidth; | ||||
| 
 | ||||
|  | @ -322,13 +322,9 @@ class MediaGallery extends React.PureComponent { | |||
|     const style = {}; | ||||
| 
 | ||||
|     if (this.isFullSizeEligible() && (standalone || !cropImages)) { | ||||
|       if (width) { | ||||
|         style.height = width / this.props.media.getIn([0, 'meta', 'small', 'aspect']); | ||||
|       } | ||||
|     } else if (width) { | ||||
|       style.height = width / (16/9); | ||||
|       style.aspectRatio = `${this.props.media.getIn([0, 'meta', 'small', 'aspect'])}`; | ||||
|     } else { | ||||
|       style.height = height; | ||||
|       style.aspectRatio = '16 / 9'; | ||||
|     } | ||||
| 
 | ||||
|     const size     = media.take(4).size; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue