fixed linting errors
This commit is contained in:
@@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
|
||||
import { forceCollide, forceSimulation } from 'd3-force';
|
||||
import RadarPlot from '../RadarPlot';
|
||||
import Segment from '../../utils/segment';
|
||||
import Color from 'color';
|
||||
import color from 'color';
|
||||
|
||||
export default class Radar extends React.Component {
|
||||
static adjustQuadrants(quadrants, radius, width, height) {
|
||||
@@ -102,7 +102,7 @@ export default class Radar extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
static adjustEntries(entries, activeEntry, quadrants, rings, radius, colors) {
|
||||
static adjustEntries(entries, activeEntry, quadrants, rings, radius) {
|
||||
let seed = 42;
|
||||
entries.forEach((entry, idx) => {
|
||||
const quadrant = quadrants.find(q => {
|
||||
@@ -137,7 +137,7 @@ export default class Radar extends React.Component {
|
||||
entry.active = activeEntry ? entry.id === activeEntry.id : false;
|
||||
entry.color = entry.active
|
||||
? entry.ring.color
|
||||
: Color(entry.ring.color)
|
||||
: color(entry.ring.color)
|
||||
.desaturate(0.5)
|
||||
.lighten(0.1)
|
||||
.string();
|
||||
@@ -214,7 +214,7 @@ export default class Radar extends React.Component {
|
||||
rings={rings}
|
||||
activeEntry={activeEntry}
|
||||
onEntryMouseEnter={entry => this._setActiveEntry(entry)}
|
||||
onEntryMouseLeave={entry => this._clearActiveEntry()}
|
||||
onEntryMouseLeave={() => this._clearActiveEntry()}
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
@@ -227,4 +227,5 @@ Radar.propTypes = {
|
||||
quadrants: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
rings: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
entries: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
svgProps: PropTypes.object,
|
||||
};
|
||||
|
||||
@@ -25,7 +25,6 @@ export default class RadarLegend extends React.PureComponent {
|
||||
rings,
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
) {
|
||||
return (
|
||||
<foreignObject
|
||||
@@ -44,7 +43,6 @@ export default class RadarLegend extends React.PureComponent {
|
||||
RadarLegend._getSegment(segments, quadrant, ring),
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
@@ -53,13 +51,7 @@ export default class RadarLegend extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
static _renderRing(
|
||||
ring,
|
||||
entries,
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
) {
|
||||
static _renderRing(ring, entries, onEntryMouseEnter, onEntryMouseLeave) {
|
||||
return (
|
||||
<div key={ring.id} className={styles.ring}>
|
||||
<h3 className={styles.ringHeading}>{ring.name}</h3>
|
||||
@@ -88,7 +80,6 @@ export default class RadarLegend extends React.PureComponent {
|
||||
onMouseLeave={
|
||||
onEntryMouseEnter && (() => onEntryMouseLeave(entry))
|
||||
}
|
||||
onClick={onEntryClick && (() => onEntryClick(entry))}
|
||||
>
|
||||
{node}
|
||||
</li>
|
||||
@@ -111,7 +102,6 @@ export default class RadarLegend extends React.PureComponent {
|
||||
entries,
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
} = this.props;
|
||||
|
||||
const segments = {};
|
||||
@@ -133,7 +123,6 @@ export default class RadarLegend extends React.PureComponent {
|
||||
rings,
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
),
|
||||
)}
|
||||
</g>
|
||||
@@ -148,5 +137,4 @@ RadarLegend.propTypes = {
|
||||
entries: PropTypes.arrayOf(PropTypes.shape(CommonPropTypes.ENTRY)).isRequired,
|
||||
onEntryMouseEnter: PropTypes.func,
|
||||
onEntryMouseLeave: PropTypes.func,
|
||||
onEntryClick: PropTypes.func,
|
||||
};
|
||||
|
||||
@@ -37,7 +37,6 @@ export default class RadarPlot extends React.PureComponent {
|
||||
activeEntry,
|
||||
onEntryMouseEnter,
|
||||
onEntryMouseLeave,
|
||||
onEntryClick,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@@ -52,7 +51,6 @@ export default class RadarPlot extends React.PureComponent {
|
||||
onEntryMouseLeave={
|
||||
onEntryMouseLeave && (entry => onEntryMouseLeave(entry))
|
||||
}
|
||||
onEntryClick={onEntryClick && (entry => onEntryClick(entry))}
|
||||
/>
|
||||
<g transform={`translate(${width / 2}, ${height / 2})`}>
|
||||
<RadarGrid radius={radius} rings={rings} />
|
||||
@@ -74,7 +72,6 @@ export default class RadarPlot extends React.PureComponent {
|
||||
onMouseLeave={
|
||||
onEntryMouseLeave && (() => onEntryMouseLeave(entry))
|
||||
}
|
||||
onClick={onEntryClick && (() => onEntryClick(entry))}
|
||||
/>
|
||||
))}
|
||||
<RadarBubble
|
||||
@@ -100,5 +97,4 @@ RadarPlot.propTypes = {
|
||||
activeEntry: PropTypes.object,
|
||||
onEntryMouseEnter: PropTypes.func,
|
||||
onEntryMouseLeave: PropTypes.func,
|
||||
onEntryClick: PropTypes.func,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user