Rename reserved keyword prop to data
This commit is contained in:
1 parent
88f5cbb254
commit
4b0ac5822a
1 file changed
+16
-3
@@ -87,6 +87,15 @@ const PieValueLabel = ({ value, startAngle, endAngle, color, highlighted }) => {
|
||||
);
|
||||
};
|
||||
|
||||
// Validate props using PropTypes
|
||||
PieValueLabel.propTypes = {
|
||||
value: PropTypes.number.isRequired,
|
||||
startAngle: PropTypes.number.isRequired,
|
||||
endAngle: PropTypes.number.isRequired,
|
||||
color: PropTypes.string.isRequired,
|
||||
highlighted: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
const PieChart = ({ audits }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
@@ -148,7 +157,7 @@ const PieChart = ({ audits }) => {
|
||||
*/
|
||||
let performance = 0;
|
||||
const getPieData = (audits) => {
|
||||
let props = [];
|
||||
let data = [];
|
||||
let startAngle = 0;
|
||||
const padding = 3; // padding between arcs
|
||||
const max = 360 - padding * (Object.keys(audits).length - 1); // _id is a child of audits
|
||||
@@ -159,7 +168,7 @@ const PieChart = ({ audits }) => {
|
||||
let endAngle = startAngle + (weights[key] * max) / 100;
|
||||
|
||||
let theme = getColors(audits[key].score * 100);
|
||||
props.push({
|
||||
data.push({
|
||||
id: key,
|
||||
data: [
|
||||
{
|
||||
@@ -195,7 +204,7 @@ const PieChart = ({ audits }) => {
|
||||
}
|
||||
});
|
||||
|
||||
return props;
|
||||
return data;
|
||||
};
|
||||
|
||||
const pieSize = { width: 230, height: 230 };
|
||||
@@ -296,4 +305,8 @@ const PieChart = ({ audits }) => {
|
||||
);
|
||||
};
|
||||
|
||||
PieChart.propTypes = {
|
||||
audits: PropTypes.object,
|
||||
};
|
||||
|
||||
export default PieChart;
|
||||
Reference in new issue
Block a user