-
Notifications
You must be signed in to change notification settings - Fork 775
/
Copy pathExportCSVButton.js
45 lines (41 loc) · 1.07 KB
/
ExportCSVButton.js
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
import React, { Component, PropTypes } from 'react';
import Const from '../Const';
const exportCsvBtnDefaultClass = 'react-bs-table-csv-btn';
class ExportCSVButton extends Component {
render() {
const {
btnContextual,
className,
onClick,
btnFAwesome,
btnText,
children,
...rest
} = this.props;
const content = children ||
(<span><i className={ `fa ${btnFAwesome}` }></i> { btnText }</span>);
return (
<button type='button'
className={ `btn ${btnContextual} ${exportCsvBtnDefaultClass} ${className} hidden-print` }
onClick={ onClick }
{ ...rest }>
{ content }
</button>
);
}
}
ExportCSVButton.propTypes = {
btnText: PropTypes.string,
btnContextual: PropTypes.string,
className: PropTypes.string,
onClick: PropTypes.func,
btnFAwesome: PropTypes.string
};
ExportCSVButton.defaultProps = {
btnText: Const.EXPORT_CSV_TEXT,
btnContextual: 'btn-success',
className: '',
onClick: undefined,
btnFAwesome: 'fa-arrow-circle-down'
};
export default ExportCSVButton;