Download wp-calypso/client/components/forms/select-opt-groups.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 661 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/select-opt-groups.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/forms/select-opt-groups.jsx
-
curl -L -o select-opt-groups.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/select-opt-groups.jsx
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; | |