Skip to content

Commit

Permalink
ADDON-34289: Updated Text, Radio and CheckBox components
Browse files Browse the repository at this point in the history
  • Loading branch information
dkhatri-crest committed Mar 5, 2021
1 parent 200b680 commit 057b670
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ class CheckBoxComponent extends Component {
super(props);
}

handleClick = (e) => {
this.props.handleClick(this.props.id, e.target.value);
handleChange = (e, {value}) => {
this.props.handleChange(this.props.id, value);
};

render() {
return (
<Switch
key={this.props.field}
value={this.props.value}
onClick={this.handleClick}
onClick={this.handleChange}
selected={this.props.value === 1 ? true : false}
appearance="checkbox"
>
{this.props.label}
</Switch>
);
}
Expand All @@ -31,7 +30,6 @@ CheckBoxComponent.propTypes = {
value: PropTypes.string,
handleClick: PropTypes.func.isRequired,
field: PropTypes.string,
label: PropTypes.string,
controlOptions: PropTypes.object,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ class RadioComponent extends Component {
super(props);
}

handleChange = (e) => {
this.props.handleChange(this.props.id, e.target.value)
handleChange = (e, { value }) => {
this.props.handleChange(this.props.id, value);
};

render() {
return (
<RadioBar
inline
onChange={this.handleChange}
value={this.props.value}
key={this.props.field}
style={{ width: 200 }}
>
{this.props.controlOptions.items.map(item => (
<RadioBar.Option key={item.value} value={item.value} label={item.label} />
Expand All @@ -32,7 +32,7 @@ RadioComponent.propTypes = {
value: PropTypes.string,
handleChange: PropTypes.func.isRequired,
field: PropTypes.string,
controlOptions: PropTypes.object
controlOptions: PropTypes.object
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class TextComponent extends Component {
super(props);
}

handleChange = (e) => {
this.props.handleChange(this.props.id, e.target.value);
handleChange = (e, {value}) => {
this.props.handleChange(this.props.id, value);
};

render() {
Expand All @@ -17,7 +17,7 @@ class TextComponent extends Component {
inline
placeholder={this.props.controlOptions.placeholder}
className={this.props.field}
disabled={this.props.controlOptions.display === false ? true : false}
disabled={this.props.disabled}
value={this.props.value}
onChange={this.handleChange}
type={this.props.encrypted === true ? 'password' : 'text'}
Expand Down

0 comments on commit 057b670

Please sign in to comment.