static getMargin()

in src/XTicks.js [71:92]


  static getMargin(props) {
    const { tickLength, position } = defaults({}, props, XTicks.defaultProps);
    const placement =
      props.placement || (position === 'top' ? 'above' : 'below');
    const zeroMargin = {
      marginTop: 0,
      marginBottom: 0,
      marginLeft: 0,
      marginRight: 0,
    };

    if (
      (position === 'bottom' && placement === 'above') ||
      (position === 'top' && placement === 'below')
    )
      return zeroMargin;

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