import getElectionPalette from "../../../../utils/colors/getElectionPalette.js";
import getColor from "../../../../utils/colors/getColor.js";
const sizes = {
  small: {
    size: 2,
    suffix: '-small',
    xform: undefined,
    strokeWidth: 0.25
  },
  medium: {
    size: 5,
    suffix: '',
    xform: 'rotate(45)',
    strokeWidth: 0.5
  }
};
const StripedPattern = function StripedPattern(props) {
  const {
    color,
    size: sizeName
  } = props;
  const palette = getElectionPalette(color);
  const {
    size,
    suffix,
    xform,
    strokeWidth
  } = sizes[sizeName];
  if (!palette) {
    return null;
  }
  const pinstripe = getColor(palette.leadingPinstripe);
  const background = getColor(palette.leadingBg);
  return <pattern id={`${color}-leading${suffix}`} patternUnits="userSpaceOnUse" width={size} height={size} patternTransform={xform}>
      <rect width={size} height={size} x="0" y="0" fill={background} />
      <line x1={size / 2} y1="0" x2={size / 2} y2={size} strokeWidth={strokeWidth} stroke={pinstripe} />
    </pattern>;
};
export default StripedPattern;