File size: 661 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import { omit } from 'lodash';
import FormSelect from 'calypso/components/forms/form-select';
const SelectOptGroups = ( props ) => {
const { optGroups, ...selectProps } = props;
return (
<FormSelect { ...omit( selectProps, [ 'moment', 'numberFormat', 'translate' ] ) }>
{ optGroups.map( ( optGroup ) => (
<optgroup label={ optGroup.label } key={ `optgroup-${ optGroup.label }` }>
{ optGroup.options.map( ( option ) => (
<option value={ option.value } key={ `option-${ optGroup.label }${ option.label }` }>
{ option.label }
</option>
) ) }
</optgroup>
) ) }
</FormSelect>
);
};
export default SelectOptGroups;
|