Skip to content

Commit

Permalink
fix: heat-map props and remove eslint react/prop-types directives
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramk committed Mar 26, 2024
1 parent b9b47c0 commit 76375d8
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions components/heat-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export default class Heatmap extends React.Component {
}

function Node(props) {
// eslint-disable-next-line react/prop-types
const { name, value, max, selected, onClick, formatValue, formatLabel } =
props;

Expand All @@ -159,8 +158,17 @@ function Node(props) {
);
}

Node.propTypes = {
name: PropTypes.string,
value: PropTypes.number,
max: PropTypes.any,
selected: PropTypes.bool,
onClick: PropTypes.func,
formatValue: PropTypes.func,
formatLabel: PropTypes.func,
};

function SingleHeatmap(props) {
// eslint-disable-next-line react/prop-types
const { title, selection, onSelect, data, onClickTitle } = props;

const titleStyle = `heat-map-title ${onClickTitle && 'clickable'}`;
Expand All @@ -183,7 +191,7 @@ function SingleHeatmap(props) {
</StackItem>
</Stack>
<div className="heat-map-grid">
{data.map((datum) => { // eslint-disable-line react/prop-types, prettier/prettier
{data.map((datum) => {
const selected = datum.name == selection;
return (
<Node
Expand All @@ -200,8 +208,16 @@ function SingleHeatmap(props) {
);
}

SingleHeatmap.propTypes = {
title: PropTypes.string,
selection: PropTypes.string,
data: PropTypes.object,
onSelect: PropTypes.func,
onClickTitle: PropTypes.func,
};

function GroupedHeatMap(props) {
const { data } = props; // eslint-disable-line react/prop-types
const { data } = props;

const groups = groupBy(data, 'group');
const groupNames = keys(groups).sort();
Expand All @@ -223,6 +239,10 @@ function GroupedHeatMap(props) {
);
}

GroupedHeatMap.propTypes = {
data: PropTypes.object,
};

function prepare({ data, max }) {
let maxValue = 0;
const isMultiFacet = Array.isArray(data.metadata.facet);
Expand Down Expand Up @@ -280,7 +300,7 @@ function ValueSpectrum() {
/**
* renders a Heatmap legend as a color spectrum
*/
export function Legend({ title, max, formatValue }) { // eslint-disable-line react/prop-types, no-unused-vars, prettier/prettier
export function Legend({ max, formatValue }) {
if (formatValue) max = formatValue(max);
return (
<div className="heat-map-legend">
Expand All @@ -290,3 +310,8 @@ export function Legend({ title, max, formatValue }) { // eslint-disable-line rea
</div>
);
}

Legend.propTypes = {
max: PropTypes.any,
formatValue: PropTypes.func,
};

0 comments on commit 76375d8

Please sign in to comment.