@@ -121,8 +121,10 @@ export interface PreviewProps extends InternalPreviewConfig {
121
121
} ;
122
122
fallback ?: string ;
123
123
124
- // Preview image
124
+ // Preview media
125
+ type ?: 'image' | 'video' ;
125
126
imgCommonProps ?: React . ImgHTMLAttributes < HTMLImageElement > ;
127
+ videoCommonProps ?: React . VideoHTMLAttributes < HTMLVideoElement > ;
126
128
width ?: string | number ;
127
129
height ?: string | number ;
128
130
@@ -165,6 +167,7 @@ const Preview: React.FC<PreviewProps> = props => {
165
167
const {
166
168
prefixCls,
167
169
rootClassName,
170
+ type = 'image' ,
168
171
src,
169
172
alt,
170
173
imageInfo,
@@ -425,13 +428,15 @@ const Preview: React.FC<PreviewProps> = props => {
425
428
{ /* Body */ }
426
429
< div className = { classnames ( `${ prefixCls } -body` , classNames . body ) } style = { bodyStyle } >
427
430
{ /* Preview Image */ }
428
- { imageRender
429
- ? imageRender ( imgNode , {
430
- transform,
431
- image,
432
- ...( groupContext ? { current } : { } ) ,
433
- } )
434
- : imgNode }
431
+ { type === 'image' &&
432
+ ( imageRender
433
+ ? imageRender ( imgNode , {
434
+ transform,
435
+ image,
436
+ ...( groupContext ? { current } : { } ) ,
437
+ } )
438
+ : imgNode ) }
439
+ { type === 'video' && < video src = { src } width = { props . width } height = { props . height } /> }
435
440
</ div >
436
441
437
442
{ /* Close Button */ }
@@ -454,37 +459,38 @@ const Preview: React.FC<PreviewProps> = props => {
454
459
/>
455
460
) }
456
461
457
- { /* Footer */ }
458
- < Footer
459
- prefixCls = { prefixCls }
460
- showProgress = { showOperationsProgress }
461
- current = { current }
462
- count = { count }
463
- showSwitch = { showLeftOrRightSwitches }
464
- // Style
465
- classNames = { classNames }
466
- styles = { styles }
467
- // Render
468
- image = { image }
469
- transform = { transform }
470
- icons = { icons }
471
- countRender = { countRender }
472
- actionsRender = { actionsRender }
473
- // Scale
474
- scale = { scale }
475
- minScale = { minScale }
476
- maxScale = { maxScale }
477
- // Actions
478
- onActive = { onActive }
479
- onFlipY = { onFlipY }
480
- onFlipX = { onFlipX }
481
- onRotateLeft = { onRotateLeft }
482
- onRotateRight = { onRotateRight }
483
- onZoomOut = { onZoomOut }
484
- onZoomIn = { onZoomIn }
485
- onClose = { onClose }
486
- onReset = { onReset }
487
- />
462
+ { type === 'image' && (
463
+ < Footer
464
+ prefixCls = { prefixCls }
465
+ showProgress = { showOperationsProgress }
466
+ current = { current }
467
+ count = { count }
468
+ showSwitch = { showLeftOrRightSwitches }
469
+ // Style
470
+ classNames = { classNames }
471
+ styles = { styles }
472
+ // Render
473
+ image = { image }
474
+ transform = { transform }
475
+ icons = { icons }
476
+ countRender = { countRender }
477
+ actionsRender = { actionsRender }
478
+ // Scale
479
+ scale = { scale }
480
+ minScale = { minScale }
481
+ maxScale = { maxScale }
482
+ // Actions
483
+ onActive = { onActive }
484
+ onFlipY = { onFlipY }
485
+ onFlipX = { onFlipX }
486
+ onRotateLeft = { onRotateLeft }
487
+ onRotateRight = { onRotateRight }
488
+ onZoomOut = { onZoomOut }
489
+ onZoomIn = { onZoomIn }
490
+ onClose = { onClose }
491
+ onReset = { onReset }
492
+ />
493
+ ) }
488
494
</ div >
489
495
) ;
490
496
} }
0 commit comments