import React, {Children} from 'react'; import PropTypes from 'prop-types'; import TileInfo from './TileInfo.js'; import TileFooter from './TileFooter.js'; import SVGIcon from './SVGIcon.js'; const Tile = ({headerText, headerColor, iconName, iconColor, className, onClick, children, dataTestId}) => { let childrenArr = Children.toArray(children); return (
{headerText}
{iconName && }
{childrenArr.find(e => e.type === TileInfo)}
{childrenArr.find(e => e.type === TileFooter)}
); }; Tile.propTypes = { headerText: PropTypes.string, headerColor: PropTypes.string, iconName: PropTypes.string, iconColor: PropTypes.string, className: PropTypes.string, onClick: PropTypes.func, dataTestId: PropTypes.string }; export default Tile;