react-code-dataset / wp-calypso /client /components /forms /select-opt-groups.jsx
Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
Raw History Blame Contribute Delete
661 Bytes
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;