All files / javascripts/explore/components ExploreActionButtons.jsx

100% Statements 10/10
100% Branches 0/0
100% Functions 1/1
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 39 40 41 42 43 44 45 461x 1x 1x 1x 1x   1x         2x 1x     1x                                                         1x  
import React, { PropTypes } from 'react';
import cx from 'classnames';
import URLShortLinkButton from './URLShortLinkButton';
import EmbedCodeButton from './EmbedCodeButton';
import DisplayQueryButton from './DisplayQueryButton';
 
const propTypes = {
  canDownload: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]).isRequired,
  slice: PropTypes.object.isRequired,
};
 
export default function ExploreActionButtons({ canDownload, slice }) {
  const exportToCSVClasses = cx('btn btn-default btn-sm', {
    'disabled disabledButton': !canDownload,
  });
  return (
    <div className="btn-group results" role="group">
      <URLShortLinkButton slice={slice} />
 
      <EmbedCodeButton slice={slice} />
 
      <a
        href={slice.data.json_endpoint}
        className="btn btn-default btn-sm"
        title="Export to .json"
        target="_blank"
      >
        <i className="fa fa-file-code-o"></i> .json
      </a>
 
      <a
        href={slice.data.csv_endpoint}
        className={exportToCSVClasses}
        title="Export to .csv format"
        target="_blank"
      >
        <i className="fa fa-file-text-o"></i> .csv
      </a>
 
      <DisplayQueryButton slice={slice} />
    </div>
  );
}
 
ExploreActionButtons.propTypes = propTypes;