Skip to content

Commit 7b06650

Browse files
committed
Restoring input-icon to what it was before refactor
1 parent 6ae06cf commit 7b06650

File tree

1 file changed

+34
-59
lines changed

1 file changed

+34
-59
lines changed

components/icon/input-icon/index.jsx

Lines changed: 34 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,41 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
1010
*/
1111

1212
import React from 'react';
13-
1413
import SLDSUtilityIcon from '../../utilities/utility-icon';
1514

16-
import { ICON_INPUT } from '../../../utilities/constants';
17-
18-
// Remove the need for `React.PropTypes`
19-
const { PropTypes } = React;
20-
21-
// ### isFunction
22-
import isFunction from 'lodash.isfunction';
23-
24-
const InputIcon = React.createClass({
25-
26-
displayName: ICON_INPUT,
27-
28-
propTypes: {
29-
category: PropTypes.string,
30-
name: PropTypes.string,
31-
style: PropTypes.string,
32-
/**
33-
* This event fires when the icon is clicked.
34-
*/
35-
onClick: PropTypes.func
36-
},
37-
38-
getDefaultProps () {
39-
return {
40-
category: 'utility'
41-
};
42-
},
43-
44-
render () {
45-
const onClickIsFunction = isFunction(this.props.onClick);
46-
47-
return (
48-
<div>
49-
{onClickIsFunction ?
50-
<button
51-
className="slds-input__icon slds-button slds-button--icon"
52-
onClick={this.props.onClick}
53-
>
54-
<SLDSUtilityIcon
55-
style={this.props.style}
56-
aria-hidden
57-
category={this.props.category}
58-
className="slds-button__icon slds-icon-text-default"
59-
name={this.props.name}
60-
/>
61-
</button>
62-
: <SLDSUtilityIcon
63-
style={this.props.style}
64-
aria-hidden
65-
category={this.props.category}
66-
className="slds-input__icon slds-icon-text-default"
67-
name={this.props.name}
68-
/>
69-
}
70-
</div>
71-
);
72-
}
73-
});
15+
const displayName = 'InputIcon';
16+
17+
const propTypes = {
18+
category: React.PropTypes.string,
19+
name: React.PropTypes.string,
20+
onClick: React.PropTypes.func,
21+
};
22+
const defaultProps = {
23+
category: 'utility',
24+
};
25+
26+
class InputIcon extends React.Component {
27+
28+
constructor(props) {
29+
super(props);
30+
this.state = {};
31+
}
32+
33+
render() {
34+
const className = 'slds-input__icon slds-icon-text-default';
35+
return <SLDSUtilityIcon
36+
style={this.props.style}
37+
aria-hidden='true'
38+
category={this.props.category}
39+
className={className}
40+
name={this.props.name}
41+
onClick={this.props.onClick}
42+
/>;
43+
}
44+
}
45+
46+
InputIcon.displayName = displayName;
47+
InputIcon.propTypes = propTypes;
48+
InputIcon.defaultProps = defaultProps;
7449

7550
module.exports = InputIcon;

0 commit comments

Comments
 (0)