Download wp-calypso/client/components/forms/form-radios-bar/index.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/form-radios-bar/index.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/forms/form-radios-bar/index.jsx
-
curl -L -o index.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/forms/form-radios-bar/index.jsx
1.12 kB
| import { FormLabel } from '@automattic/components'; | |
| import clsx from 'clsx'; | |
| import PropTypes from 'prop-types'; | |
| import FormRadio from 'calypso/components/forms/form-radio'; | |
| import FormRadioWithThumbnail from 'calypso/components/forms/form-radio-with-thumbnail'; | |
| import './style.scss'; | |
| const FormRadiosBar = ( { isThumbnail, checked, onChange, items, disabled } ) => { | |
| return ( | |
| <div className={ clsx( 'form-radios-bar', { 'is-thumbnail': isThumbnail } ) }> | |
| { items.map( ( item, i ) => | |
| isThumbnail ? ( | |
| <FormRadioWithThumbnail | |
| key={ item.value + i } | |
| checked={ checked === item.value } | |
| onChange={ onChange } | |
| disabled={ disabled } | |
| { ...item } | |
| /> | |
| ) : ( | |
| <FormLabel key={ item.value + i }> | |
| <FormRadio | |
| checked={ checked === item.value } | |
| disabled={ disabled } | |
| onChange={ onChange } | |
| { ...item } | |
| /> | |
| </FormLabel> | |
| ) | |
| ) } | |
| </div> | |
| ); | |
| }; | |
| FormRadiosBar.propTypes = { | |
| isThumbnail: PropTypes.bool, | |
| checked: PropTypes.string, | |
| onChange: PropTypes.func, | |
| items: PropTypes.array.isRequired, | |
| }; | |
| export default FormRadiosBar; | |