import React, { PureComponent } from 'react';
import Chip from '@material-ui/core/Chip';
import Tooltip from '@material-ui/core/Tooltip';
class ProProgressRowChip extends PureComponent {
constructor(props) {
super(props);
this.state = {
tooltipMsg: ''
};
}
changeColor = progressStatus => {
switch (progressStatus) {
case 1:
this.setState({
tooltipMsg: 'Not Started'
});
break;
case 2:
this.setState({
tooltipMsg: 'In Progress'
});
break;
case 3:
this.setState({
tooltipMsg: 'Completed'
});
break;
default:
console.log('unknown category');
break;
}
};
render() {
const { tooltipMsg } = this.state;
const { rowdata } = this.props;
this.changeColor(rowdata.QuestionnaireStatus);
return (
<div className="questinnaie-chip">
<Tooltip title={tooltipMsg}>
<Chip label={rowdata.QuestionnaireDisplayName} className={"QuestionnaireStatus"+rowdata.QuestionnaireStatus}/>
</Tooltip>
</div>
);
}
}
export default ProProgressRowChip;
|