Skip to content

Commit ee829eb

Browse files
authored
Merge pull request #1190 from Ymbere/fix_1185
Fix 1185
2 parents ae34c44 + b99a277 commit ee829eb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/react-bootstrap-table2/src/bootstrap-table.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ class BootstrapTable extends PropsBaseResolver(Component) {
8383

8484
const hasFooter = _.filter(columns, col => _.has(col, 'footer')).length > 0;
8585

86-
const tableCaption = (caption && <Caption>{ caption }</Caption>);
86+
const tableCaption = (
87+
caption && <Caption bootstrap4={ bootstrap4 }>{ caption }</Caption>
88+
);
8789

8890
return (
8991
<div className={ tableWrapperClass }>

packages/react-bootstrap-table2/src/caption.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ import PropTypes from 'prop-types';
44

55
const Caption = (props) => {
66
if (!props.children) return null;
7-
return (
8-
<caption>{ props.children }</caption>
7+
8+
const caption = props.bootstrap4 ? (
9+
<caption style={ { captionSide: 'top' } }>{props.children}</caption>
10+
) : (
11+
<caption>{props.children}</caption>
912
);
13+
14+
return caption;
1015
};
1116

1217
Caption.propTypes = {
1318
children: PropTypes.oneOfType([
1419
PropTypes.node,
1520
PropTypes.string
16-
])
21+
]),
22+
bootstrap4: PropTypes.bool
1723
};
1824

1925
export default Caption;

0 commit comments

Comments
 (0)