Skip to content

Commit

Permalink
Merge pull request #268 from 10up/fix/pass-through-render-item-type
Browse files Browse the repository at this point in the history
fix pass-through-render-item-type to ContentSearch
  • Loading branch information
fabiankaegy authored Sep 28, 2023
2 parents 1552ff8 + 2ca3df6 commit cee44ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/content-picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
import { ContentSearch } from '../content-search';
import SortableList from './SortableList';
import { StyledComponentContext } from '../styled-components-context';
import { defaultRenderItemType } from '../content-search/SearchItem';

const NAMESPACE = 'tenup-content-picker';

Expand Down Expand Up @@ -51,6 +52,7 @@ const ContentPickerWrapper = styled.div`
* @param {boolean} props.excludeCurrentPost whether or not to exclude the current post from the picker
* @param {number} props.perPage number of items to show per page
* @param {boolean} props.fetchInitialResults whether or not to fetch initial results on mount
* @param {Function} props.renderItemType callback to render the item type
* @returns {*} React JSX
*/
const ContentPicker = ({
Expand All @@ -69,6 +71,7 @@ const ContentPicker = ({
excludeCurrentPost,
perPage,
fetchInitialResults,
renderItemType,
}) => {
const currentPostId = select('core/editor')?.getCurrentPostId();

Expand Down Expand Up @@ -134,6 +137,7 @@ const ContentPicker = ({
queryFilter={queryFilter}
perPage={perPage}
fetchInitialResults={fetchInitialResults}
renderItemType={renderItemType}
/>
) : (
label && (
Expand Down Expand Up @@ -196,6 +200,7 @@ ContentPicker.defaultProps = {
multiPickedLabel: __('You have selected the following items:', '10up-block-components'),
singlePickedLabel: __('You have selected the following item:', '10up-block-components'),
fetchInitialResults: false,
renderItemType: defaultRenderItemType,
};

ContentPicker.propTypes = {
Expand All @@ -214,6 +219,7 @@ ContentPicker.propTypes = {
maxContentItems: PropTypes.number,
perPage: PropTypes.number,
fetchInitialResults: PropTypes.bool,
renderItemType: PropTypes.func,
};

export { ContentPicker };

0 comments on commit cee44ca

Please sign in to comment.