static getMargin()

in src/YTicks.js [71:92]


  static getMargin(props) {
    const { tickLength, position } = defaults({}, props, YTicks.defaultProps);
    const placement =
      props.placement || (position === 'left' ? 'before' : 'after');
    const zeroMargin = {
      marginTop: 0,
      marginBottom: 0,
      marginLeft: 0,
      marginRight: 0,
    };

    if (
      (position === 'left' && placement === 'after') ||
      (position === 'right' && placement === 'before')
    )
      return zeroMargin;

    return defaults(
      { [`margin${capitalize(position)}`]: tickLength || 0 },
      zeroMargin,
    );
  }