woocommerce/packages/woocommerce-blocks/assets/js/base/components/textarea/index.js

44 lines
735 B
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
/**
* External dependencies
*/
import classnames from 'classnames';
import PropTypes from 'prop-types';
/**
* Internal dependencies
*/
import './style.scss';
const Textarea = ( {
className = '',
disabled = false,
onTextChange,
placeholder,
value = '',
} ) => {
return (
<textarea
className={ classnames(
'wc-block-components-textarea',
className
) }
disabled={ disabled }
onChange={ ( event ) => {
onTextChange( event.target.value );
} }
placeholder={ placeholder }
rows={ 2 }
value={ value }
/>
);
};
Textarea.propTypes = {
onTextChange: PropTypes.func.isRequired,
disabled: PropTypes.bool,
placeholder: PropTypes.string,
value: PropTypes.string,
};
export default Textarea;