import PropTypes from 'prop-types'; import React, { useEffect, useRef } from 'react'; import cardBuilder from '../cardbuilder/cardBuilder'; // There seems to be some compatibility issues here between // React and our legacy web components, so we need to inject // them as an html string for now =/ const createScroller = ({ title = '' }) => ({ __html: `

${title}

` }); const SearchResultsRow = ({ title, items = [], cardOptions = {} }) => { const element = useRef(null); useEffect(() => { cardBuilder.buildCards(items, { itemsContainer: element.current?.querySelector('.itemsContainer'), parentContainer: element.current, shape: 'autooverflow', scalable: true, showTitle: true, overlayText: false, centerText: true, allowBottomPadding: false, ...cardOptions }); }, [ items ]); return (
); }; SearchResultsRow.propTypes = { title: PropTypes.string, items: PropTypes.array, cardOptions: PropTypes.object }; export default SearchResultsRow;