import React, { useCallback } from "react"; import { Button, ButtonGroup, Tooltip, Icon } from "@blueprintjs/core"; import { IconNames } from "@blueprintjs/icons"; import * as globals from "../../globals"; const HistogramHeader = React.memo( ({ fieldId, isColorBy, onColorByClick, onRemoveClick, isScatterPlotX, isScatterPlotY, onScatterPlotXClick, onScatterPlotYClick, isObs, }) => { /* Render the toolbar for the histogram. Props: * fieldId - field identifier, used for various IDs * isColorBy - true/false, is this the current color-by * onColorByClick - color-by click handler * onRemoveClick - optional handler for remove. Button will not render if not defined. * isScatterPlotX - optional, true/false if currently the X scatterplot field * isScatterPlotY - optional, true/false if currently the Y scatterplot field * onScatterPlotXClick - optional, handler for scatterPlot X button. * onScatterPlotYClick - optional, handler for scatterPlot X button. Scatterplot controls will not render if either handler unspecified. */ const memoizedColorByCallback = useCallback( () => onColorByClick(fieldId, isObs), [fieldId, isObs] ); return (