mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
This reverts commit af46bbf654
.
This commit is contained in:
parent
bf83fb80b7
commit
d76c056656
@ -8,29 +8,25 @@ interface Props {
|
||||
onColorChange: (color: string) => void;
|
||||
}
|
||||
|
||||
export const VizLegendSeriesIcon = React.memo<Props>(
|
||||
({ disabled, color, onColorChange }) => {
|
||||
return disabled ? (
|
||||
<SeriesIcon color={color} />
|
||||
) : (
|
||||
<SeriesColorPicker color={color} onChange={onColorChange} enableNamedColors>
|
||||
{({ ref, showColorPicker, hideColorPicker }) => (
|
||||
<SeriesIcon
|
||||
color={color}
|
||||
className="pointer"
|
||||
ref={ref}
|
||||
onClick={showColorPicker}
|
||||
onMouseLeave={hideColorPicker}
|
||||
/>
|
||||
)}
|
||||
</SeriesColorPicker>
|
||||
);
|
||||
},
|
||||
// areEqual -- return true if they are the same.
|
||||
// onColorChange updates frequently, so ignore that
|
||||
(prevProps, nextProps) => {
|
||||
return prevProps.color === nextProps.color && prevProps.disabled === nextProps.disabled;
|
||||
}
|
||||
);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const VizLegendSeriesIcon: React.FunctionComponent<Props> = ({ disabled, color, onColorChange }) => {
|
||||
return disabled ? (
|
||||
<SeriesIcon color={color} />
|
||||
) : (
|
||||
<SeriesColorPicker color={color} onChange={onColorChange} enableNamedColors>
|
||||
{({ ref, showColorPicker, hideColorPicker }) => (
|
||||
<SeriesIcon
|
||||
color={color}
|
||||
className="pointer"
|
||||
ref={ref}
|
||||
onClick={showColorPicker}
|
||||
onMouseLeave={hideColorPicker}
|
||||
/>
|
||||
)}
|
||||
</SeriesColorPicker>
|
||||
);
|
||||
};
|
||||
|
||||
VizLegendSeriesIcon.displayName = 'VizLegendSeriesIcon';
|
||||
|
Loading…
Reference in New Issue
Block a user