UNPKG

@hackoregon/component-library

Version:

Official repo for Hack Oregon React component library

36 lines (34 loc) 832 B
import React from "react"; import PropTypes from "prop-types"; import { Line } from "victory"; var GradientLine = function GradientLine(_ref) { var x = _ref.x, datum = _ref.datum, scale = _ref.scale; var isPrimary = datum.type === "primary"; var stroke = isPrimary ? "#721d7c" : "#AAA4AB"; var overlap = isPrimary ? 0 : 0; var width = isPrimary ? 8 : 6; var opacity = isPrimary ? 1 : 1; return React.createElement(Line, { y1: scale.y(0) + overlap, y2: scale.y(1) - overlap, x1: x, x2: x, style: { stroke: stroke, strokeWidth: width, strokeOpacity: opacity } }); }; GradientLine.propTypes = { x: PropTypes.number, datum: PropTypes.shape({ type: PropTypes.string }), scale: PropTypes.shape({ y: PropTypes.func }) }; export default GradientLine;