import { FormInputValidation, FormLabel } from '@automattic/components'; import clsx from 'clsx'; import PropTypes from 'prop-types'; import { PureComponent } from 'react'; import FormSelect from 'calypso/components/forms/form-select'; import { gaRecordEvent } from 'calypso/lib/analytics/ga'; export default class Select extends PureComponent { static propTypes = { label: PropTypes.string.isRequired, name: PropTypes.string.isRequired, onChange: PropTypes.func.isRequired, options: PropTypes.array.isRequired, value: PropTypes.string.isRequired, additionalClasses: PropTypes.string, errorMessage: PropTypes.string, disabled: PropTypes.bool, }; static defaultProps = { additionalClasses: '', errorMessage: '', disabled: false, }; recordFieldClick = () => { if ( this.props.eventFormName ) { gaRecordEvent( 'Upgrades', `Clicked ${ this.props.eventFormName } Field`, this.props.name ); } }; render() { const classes = clsx( this.props.additionalClasses, this.props.name ); const validationId = `validation-field-${ this.props.name }`; return (
{ this.props.label } { this.props.options.map( ( option ) => ( ) ) } { this.props.errorMessage && ( ) }
); } }