-
Notifications
You must be signed in to change notification settings - Fork 763
Expand file tree
/
Copy pathInsertButton.js
More file actions
45 lines (41 loc) · 1.02 KB
/
InsertButton.js
File metadata and controls
45 lines (41 loc) · 1.02 KB
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 insertBtnDefaultClass = 'react-bs-table-add-btn';
class InsertButton 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} ${insertBtnDefaultClass} ${className}` }
onClick={ onClick }
{ ...rest }>
{ content }
</button>
);
}
}
InsertButton.propTypes = {
btnText: PropTypes.string,
btnContextual: PropTypes.string,
className: PropTypes.string,
onClick: PropTypes.func,
btnFAwesome: PropTypes.string
};
InsertButton.defaultProps = {
btnText: Const.INSERT_BTN_TEXT,
btnContextual: 'btn-info',
className: '',
onClick: undefined,
btnFAwesome: 'fa-plus'
};
export default InsertButton;