@hackoregon/component-library
Version:
Official repo for Hack Oregon React component library
34 lines (32 loc) • 840 B
JavaScript
import React from "react";
import PropTypes from "prop-types";
import { Box } from "victory";
var GradientBox = function GradientBox(_ref) {
var scale = _ref.scale,
domain = _ref.domain,
fill = _ref.fill;
var width = scale.x(domain.x[1]) - scale.x(domain.x[0]);
var height = Math.abs(scale.y(domain.y[1]) - scale.y(domain.y[0]));
return React.createElement(Box, {
x: scale.x(domain.x[0]),
y: scale.y(domain.y[1]),
width: width,
height: height,
style: {
fill: fill,
stroke: "none"
}
});
};
GradientBox.propTypes = {
scale: PropTypes.shape({
y: PropTypes.func,
x: PropTypes.func
}),
domain: PropTypes.shape({
x: PropTypes.arrayOf(PropTypes.number),
y: PropTypes.arrayOf(PropTypes.number)
}),
fill: PropTypes.string.isRequired
};
export default GradientBox;