all files / src/chart/ ChartBody.jsx

64% Statements 16/25
0% Branches 0/2
0% Functions 0/9
66.67% Lines 16/24
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                                                                                
import React from 'react';
import PropTypes from 'prop-types';
import $ from 'jquery';
 
const propTypes = {
  containerId: PropTypes.string.isRequired,
  vizType: PropTypes.string.isRequired,
  height: PropTypes.func.isRequired,
  width: PropTypes.func.isRequired,
  faded: PropTypes.bool,
};
 
class ChartBody extends React.PureComponent {
  html(data) {
    this.el.innerHTML = data;
  }
 
  css(property, value) {
    this.el.style[property] = value;
  }
 
  get(n) {
    return $(this.el).get(n);
  }
 
  find(classname) {
    return $(this.el).find(classname);
  }
 
  show() {
    return $(this.el).show();
  }
 
  height() {
    return this.props.height();
  }
 
  width() {
    return this.props.width();
  }
 
  render() {
    return (
      <div
        id={this.props.containerId}
        className={`slice_container ${this.props.vizType}${this.props.faded ? ' faded' : ''}`}
        ref={(el) => { this.el = el; }}
      />
    );
  }
}
 
ChartBody.propTypes = propTypes;
 
export default ChartBody;