import React from 'react';
import PropTypes from 'prop-types';
import {
Scrollable, SelectableBox, Spinner,
} from '@edx/paragon';
import {
FormattedMessage,
injectIntl,
intlShape,
MessageDescriptor,
} from '@edx/frontend-platform/i18n';
import messages from './messages';
import GalleryCard from './GalleryCard';
export const Gallery = ({
galleryIsEmpty,
searchIsEmpty,
displayList,
highlighted,
onHighlightChange,
emptyGalleryLabel,
showIdsOnCards,
height,
isLoaded,
// injected
intl,
}) => {
if (!isLoaded) {
return (
);
}
if (galleryIsEmpty) {
return (
);
}
if (searchIsEmpty) {
return (
);
}
return (
{ displayList.map(asset => ) }
);
};
Gallery.defaultProps = {
highlighted: '',
showIdsOnCards: false,
height: '375px',
emptyGalleryLabel: null,
};
Gallery.propTypes = {
isLoaded: PropTypes.bool.isRequired,
galleryIsEmpty: PropTypes.bool.isRequired,
searchIsEmpty: PropTypes.bool.isRequired,
displayList: PropTypes.arrayOf(PropTypes.object).isRequired,
highlighted: PropTypes.string,
onHighlightChange: PropTypes.func.isRequired,
emptyGalleryLabel: MessageDescriptor,
showIdsOnCards: PropTypes.bool,
height: PropTypes.string,
// injected
intl: intlShape.isRequired,
};
export default injectIntl(Gallery);