All files / javascripts/explore/components QueryAndSaveBtns.jsx

100% Statements 10/10
100% Branches 0/0
66.67% Functions 2/3
100% Lines 10/10
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 391x 1x   1x           1x 1x     9x 3x       3x                                   1x 1x  
import React, { PropTypes } from 'react';
import classnames from 'classnames';
 
const propTypes = {
  canAdd: PropTypes.string.isRequired,
  onQuery: PropTypes.func.isRequired,
  onSave: PropTypes.func,
};
 
const defaultProps = {
  onSave: () => {},
};
 
export default function QueryAndSaveBtns({ canAdd, onQuery, onSave }) {
  const saveClasses = classnames('btn btn-default btn-sm', {
    'disabled disabledButton': canAdd !== 'True',
  });
 
  return (
    <div className="btn-group query-and-save">
      <button id="query_button" type="button" className="btn btn-primary btn-sm" onClick={onQuery}>
        <i className="fa fa-bolt"></i> Query
      </button>
      <button
        type="button"
        className={saveClasses}
        data-target="#save_modal"
        data-toggle="modal"
        onClick={onSave}
      >
        <i className="fa fa-plus-circle"></i> Save as
      </button>
    </div>
  );
}
 
QueryAndSaveBtns.propTypes = propTypes;
QueryAndSaveBtns.defaultProps = defaultProps;