// Package imports import React from 'react'; import PropTypes from 'prop-types'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * export default class LocalSettingsPageItem extends React.PureComponent { static propTypes = { children: PropTypes.node.isRequired, id: PropTypes.string.isRequired, options: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string.isRequired, message: PropTypes.string.isRequired, hint: PropTypes.string, })), value: PropTypes.any, placeholder: PropTypes.string, }; render () { const { id, options, children, placeholder, value } = this.props; if (options && options.length > 0) { const currentValue = value; const optionElems = options && options.length > 0 && options.map((opt) => { let optionId = `${id}--${opt.value}`; return ( ); }); return (
{children} {optionElems}
); } else if (placeholder) { return (
); } else return (
); } }