/** @format */ /** * External dependencies */ import { Component, Fragment } from '@wordpress/element'; import classnames from 'classnames'; import PropTypes from 'prop-types'; import { partial, uniqueId } from 'lodash'; /** * Internal dependencies */ import './style.scss'; class SegmentedSelection extends Component { render() { const { className, options, selected, onSelect, name, legend } = this.props; return (
{ legend }
{ options.map( ( { value, label } ) => { if ( ! value || ! label ) { return null; } const id = uniqueId( `${ value }_` ); return ( ); } ) }
); } } SegmentedSelection.propTypes = { className: PropTypes.string, options: PropTypes.arrayOf( PropTypes.shape( { value: PropTypes.string.isRequired, label: PropTypes.string.isRequired, } ) ).isRequired, selected: PropTypes.string, onSelect: PropTypes.func.isRequired, name: PropTypes.string.isRequired, legend: PropTypes.string.isRequired, }; export default SegmentedSelection;