AG-1053 Tidy react examples, make more idiomatic
This commit is contained in:
24
src-examples/richGridExample/ProficiencyCellRenderer.jsx
Normal file
24
src-examples/richGridExample/ProficiencyCellRenderer.jsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from 'react';
|
||||
|
||||
// cell renderer for the proficiency column. this is a very basic cell renderer,
|
||||
// it is arguable that we should not of used React and just returned a string of
|
||||
// html as a normal ag-Grid cellRenderer.
|
||||
export default class ProficiencyCellRenderer extends React.Component {
|
||||
|
||||
render() {
|
||||
let backgroundColor;
|
||||
if (this.props.value < 20) {
|
||||
backgroundColor = 'red';
|
||||
} else if (this.props.value < 60) {
|
||||
backgroundColor = '#ff9900';
|
||||
} else {
|
||||
backgroundColor = '#00A000';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="div-percent-bar" style={{width: this.props.value + '%', backgroundColor: backgroundColor}}>
|
||||
<div className="div-percent-value">{this.props.value}%</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user