Added onKeyDown prop to Input comp

This commit is contained in:
Ajay Bura 2021-09-13 16:29:42 +05:30
parent 64abfd4408
commit 767784a79c

View file

@ -8,6 +8,7 @@ function Input({
id, label, value, placeholder, id, label, value, placeholder,
required, type, onChange, forwardRef, required, type, onChange, forwardRef,
resizable, minHeight, onResize, state, resizable, minHeight, onResize, state,
onKeyDown,
}) { }) {
return ( return (
<div className="input-container"> <div className="input-container">
@ -26,6 +27,7 @@ function Input({
autoComplete="off" autoComplete="off"
onChange={onChange} onChange={onChange}
onResize={onResize} onResize={onResize}
onKeyDown={onKeyDown}
/> />
) : ( ) : (
<input <input
@ -38,6 +40,7 @@ function Input({
defaultValue={value} defaultValue={value}
autoComplete="off" autoComplete="off"
onChange={onChange} onChange={onChange}
onKeyDown={onKeyDown}
/> />
)} )}
</div> </div>
@ -57,6 +60,7 @@ Input.defaultProps = {
minHeight: 46, minHeight: 46,
onResize: null, onResize: null,
state: 'normal', state: 'normal',
onKeyDown: null,
}; };
Input.propTypes = { Input.propTypes = {
@ -72,6 +76,7 @@ Input.propTypes = {
minHeight: PropTypes.number, minHeight: PropTypes.number,
onResize: PropTypes.func, onResize: PropTypes.func,
state: PropTypes.oneOf(['normal', 'success', 'error']), state: PropTypes.oneOf(['normal', 'success', 'error']),
onKeyDown: PropTypes.func,
}; };
export default Input; export default Input;