-
{img.displayName}
+
{asset.displayName}
+ { showId && (
+
+
+
+ )}
,
- time: ,
+ date: ,
+ time: ,
}}
/>
@@ -31,8 +45,12 @@ export const GalleryCard = ({
);
+GalleryCard.defaultProps = {
+ showId: false,
+};
+
GalleryCard.propTypes = {
- img: PropTypes.shape({
+ asset: PropTypes.shape({
contentType: PropTypes.string,
displayName: PropTypes.string,
externalUrl: PropTypes.string,
@@ -43,6 +61,7 @@ GalleryCard.propTypes = {
thumbnail: PropTypes.string,
url: PropTypes.string,
}).isRequired,
+ showId: PropTypes.bool,
};
export default GalleryCard;
diff --git a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/GalleryCard.test.jsx b/src/editors/sharedComponents/SelectionModal/GalleryCard.test.jsx
similarity index 92%
rename from src/editors/sharedComponents/ImageUploadModal/SelectImageModal/GalleryCard.test.jsx
rename to src/editors/sharedComponents/SelectionModal/GalleryCard.test.jsx
index 7769d71b4..cd8577d18 100644
--- a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/GalleryCard.test.jsx
+++ b/src/editors/sharedComponents/SelectionModal/GalleryCard.test.jsx
@@ -12,7 +12,7 @@ describe('GalleryCard component', () => {
};
let el;
beforeEach(() => {
- el = shallow(
);
+ el = shallow(
);
});
test(`snapshot: dateAdded=${img.dateAdded}`, () => {
expect(el).toMatchSnapshot();
diff --git a/src/editors/sharedComponents/SelectionModal/SearchSort.jsx b/src/editors/sharedComponents/SelectionModal/SearchSort.jsx
new file mode 100644
index 000000000..3a54af3ce
--- /dev/null
+++ b/src/editors/sharedComponents/SelectionModal/SearchSort.jsx
@@ -0,0 +1,135 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import {
+ ActionRow, Dropdown, Form, Icon, IconButton,
+} from '@edx/paragon';
+import { Close, Search } from '@edx/paragon/icons';
+import {
+ FormattedMessage,
+ injectIntl,
+ MessageDescriptor,
+ intlShape,
+} from '@edx/frontend-platform/i18n';
+
+import messages from './messages';
+
+export const SearchSort = ({
+ searchString,
+ onSearchChange,
+ clearSearchString,
+ sortBy,
+ onSortClick,
+ sortKeys,
+ sortMessages,
+ filterBy,
+ onFilterClick,
+ filterKeys,
+ filterMessages,
+ showSwitch,
+ switchMessage,
+ onSwitchClick,
+ // injected
+ intl,
+}) => (
+
+
+
+ )
+ :
+ }
+ value={searchString}
+ />
+
+
+ { !showSwitch && }
+
+
+
+
+
+ {Object.keys(sortKeys).map(key => (
+
+
+
+ ))}
+
+
+
+ { filterKeys && filterMessages && (
+
+
+
+
+
+ {Object.keys(filterKeys).map(key => (
+
+
+
+ ))}
+
+
+ )}
+
+ { showSwitch && (
+ <>
+
+
+
+
+
+
+ >
+ )}
+
+
+);
+
+SearchSort.defaultProps = {
+ filterBy: '',
+ onFilterClick: null,
+ filterKeys: null,
+ filterMessages: null,
+ showSwitch: false,
+ switchMessage: null,
+ onSwitchClick: null,
+};
+
+SearchSort.propTypes = {
+ searchString: PropTypes.string.isRequired,
+ onSearchChange: PropTypes.func.isRequired,
+ clearSearchString: PropTypes.func.isRequired,
+ sortBy: PropTypes.string.isRequired,
+ onSortClick: PropTypes.func.isRequired,
+ sortKeys: PropTypes.shape({}).isRequired,
+ sortMessages: PropTypes.shape({}).isRequired,
+ filterBy: PropTypes.string,
+ onFilterClick: PropTypes.func,
+ filterKeys: PropTypes.shape({}),
+ filterMessages: PropTypes.shape({}),
+ showSwitch: PropTypes.bool,
+ switchMessage: MessageDescriptor,
+ onSwitchClick: PropTypes.func,
+ // injected
+ intl: intlShape.isRequired,
+};
+
+export default injectIntl(SearchSort);
diff --git a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/SearchSort.test.jsx b/src/editors/sharedComponents/SelectionModal/SearchSort.test.jsx
similarity index 90%
rename from src/editors/sharedComponents/ImageUploadModal/SelectImageModal/SearchSort.test.jsx
rename to src/editors/sharedComponents/SelectionModal/SearchSort.test.jsx
index bb2b98676..dbb5e9de9 100644
--- a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/SearchSort.test.jsx
+++ b/src/editors/sharedComponents/SelectionModal/SearchSort.test.jsx
@@ -3,9 +3,9 @@ import { shallow } from 'enzyme';
import { Dropdown } from '@edx/paragon';
import { FormattedMessage } from '@edx/frontend-platform/i18n';
-import { formatMessage } from '../../../../testUtils';
+import { formatMessage } from '../../../testUtils';
-import { sortKeys, sortMessages } from './utils';
+import { sortKeys, sortMessages } from '../ImageUploadModal/SelectImageModal/utils';
import { SearchSort } from './SearchSort';
describe('SearchSort component', () => {
@@ -14,6 +14,8 @@ describe('SearchSort component', () => {
onSearchChange: jest.fn().mockName('props.onSearchChange'),
clearSearchString: jest.fn().mockName('props.clearSearchString'),
sortBy: sortKeys.dateOldest,
+ sortKeys,
+ sortMessages,
onSortClick: jest.fn().mockName('props.onSortClick'),
intl: { formatMessage },
};
diff --git a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/__snapshots__/Gallery.test.jsx.snap b/src/editors/sharedComponents/SelectionModal/__snapshots__/Gallery.test.jsx.snap
similarity index 81%
rename from src/editors/sharedComponents/ImageUploadModal/SelectImageModal/__snapshots__/Gallery.test.jsx.snap
rename to src/editors/sharedComponents/SelectionModal/__snapshots__/Gallery.test.jsx.snap
index 74efb5b18..92be690c8 100644
--- a/src/editors/sharedComponents/ImageUploadModal/SelectImageModal/__snapshots__/Gallery.test.jsx.snap
+++ b/src/editors/sharedComponents/SelectionModal/__snapshots__/Gallery.test.jsx.snap
@@ -9,11 +9,7 @@ exports[`TextEditor Image Gallery component component snapshot: loaded but no im
}
}
>
-
+
`;
@@ -29,7 +25,7 @@ exports[`TextEditor Image Gallery component component snapshot: loaded but searc