UNPKG

contiago-toolbar

Version:

One of the options for outputting content from contiago xml-server

50 lines (46 loc) 1.32 kB
import React from 'react'; import PropTypes from 'prop-types'; import ImagePreview from 'components/ImagePreview'; import Container from './Container'; import Files from './Files'; import Media from './Media'; const Attachments = ({ files, images, videos, previewImage, onSetPreviewImage }) => { const mediaItemsSize = files && files.length ? '5vw' : '10vw'; const mediaIconSize = files && files.length ? '3vw' : '4vw'; const filesAttch = files && files.length ? <Files files={files} /> : null; const mediaAttch = (videos || images) && (videos.length || images.length) ? (<Media videos={videos} images={images} size={mediaItemsSize} iconSize={mediaIconSize} onSetPreviewImage={onSetPreviewImage} />) : null; return ( <div> {Object.keys(previewImage).length ? <Container> <ImagePreview image={previewImage} onClosePreviewImage={onSetPreviewImage} /> </Container> : <Container> {mediaAttch} {filesAttch} </Container> } </div> ); }; Attachments.propTypes = { files: PropTypes.array, images: PropTypes.array, videos: PropTypes.array, onSetPreviewImage: PropTypes.func, previewImage: PropTypes.object, }; export default Attachments;