Merge pull request #1190 from Ymbere/fix_1185

Fix 1185
This commit is contained in:
Allen 2019-12-07 13:26:54 +08:00 committed by GitHub
commit ee829eb924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -83,7 +83,9 @@ class BootstrapTable extends PropsBaseResolver(Component) {
const hasFooter = _.filter(columns, col => _.has(col, 'footer')).length > 0;
const tableCaption = (caption && <Caption>{ caption }</Caption>);
const tableCaption = (
caption && <Caption bootstrap4={ bootstrap4 }>{ caption }</Caption>
);
return (
<div className={ tableWrapperClass }>

View File

@ -4,16 +4,22 @@ import PropTypes from 'prop-types';
const Caption = (props) => {
if (!props.children) return null;
return (
<caption>{ props.children }</caption>
const caption = props.bootstrap4 ? (
<caption style={ { captionSide: 'top' } }>{props.children}</caption>
) : (
<caption>{props.children}</caption>
);
return caption;
};
Caption.propTypes = {
children: PropTypes.oneOfType([
PropTypes.node,
PropTypes.string
])
]),
bootstrap4: PropTypes.bool
};
export default Caption;