Files
weave-scope/client/app/scripts/components/warning.js
Simon Howe 8a6cc7ed4d Switch over to <i> from <span> for icons
- to select in styles, as fa5 has other prefix classnames (far, fab,
  fas)
2018-11-13 12:51:47 +01:00

39 lines
875 B
JavaScript

import React from 'react';
import classnames from 'classnames';
class Warning extends React.Component {
constructor(props, context) {
super(props, context);
this.handleClick = this.handleClick.bind(this);
this.state = {
expanded: false
};
}
handleClick() {
const expanded = !this.state.expanded;
this.setState({ expanded });
}
render() {
const { text } = this.props;
const { expanded } = this.state;
const className = classnames('warning', {
'warning-expanded': expanded
});
return (
<div className={className} onClick={this.handleClick}>
<div className="warning-wrapper">
<i className="warning-icon fa fa-exclamation-triangle" title={text} />
{expanded && <span className="warning-text">{text}</span>}
</div>
</div>
);
}
}
export default Warning;