import React from 'react'; import classNames from 'classnames'; import { nodeShapePolygon } from '../utils/node-shape-utils'; import { getMetricValue, getMetricColor, getClipPathDefinition, renderMetricValue, } from '../utils/metric-utils'; import { NODE_SHAPE_HIGHLIGHT_RADIUS, NODE_SHAPE_BORDER_RADIUS, NODE_SHAPE_SHADOW_RADIUS, } from '../constants/styles'; export default function NodeShapeHexagon({ id, highlighted, color, metric }) { const { height, hasMetric, formattedValue } = getMetricValue(metric); const metricStyle = { fill: getMetricColor(metric) }; const className = classNames('shape', 'shape-hexagon', { metrics: hasMetric }); const pathProps = r => ({ d: nodeShapePolygon(r, 6) }); const clipId = `mask-${id}`; return ( {hasMetric && getClipPathDefinition(clipId, height)} {highlighted && } {hasMetric && } {renderMetricValue(formattedValue, highlighted && hasMetric)} ); }