Added isRequired opt to Input, Textarea

• Added:
- isRequired opt to Input, Textarea
This commit is contained in:
mgabdev 2020-09-02 17:54:36 -05:00
parent 9ca6b6a884
commit 8d07aa7564
2 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class Input extends React.PureComponent {
id,
hideLabel,
maxLength,
isRequired,
} = this.props
const inputClasses = CX({
@ -93,6 +94,7 @@ class Input extends React.PureComponent {
onBlur={onBlur}
readOnly={readOnly}
maxLength={maxLength}
required={isRequired ? true : undefined}
/>
{
@ -128,6 +130,7 @@ Input.propTypes = {
readOnly: PropTypes.string,
inputRef: PropTypes.func,
id: PropTypes.string.isRequired,
isRequired: PropTypes.bool,
hideLabel: PropTypes.bool,
maxLength: PropTypes.number,
}

View File

@ -18,6 +18,7 @@ class Textarea extends React.PureComponent {
onFocus,
onBlur,
title,
isRequired,
} = this.props
const inputClasses = CX({
@ -57,6 +58,7 @@ class Textarea extends React.PureComponent {
onKeyUp={onKeyUp}
onFocus={onFocus}
onBlur={onBlur}
required={isRequired ? true : undefined}
/>
</div>
@ -74,6 +76,7 @@ Textarea.propTypes = {
onFocus: PropTypes.func,
onBlur: PropTypes.func,
title: PropTypes.string,
isRequired: PropTypes.bool,
}
export default Textarea