mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
Fix issue with caption on bootstrap 4
Add new prop to check if bootstrap is used Update component in order to return a custom caption when bootstrap4 is in use
This commit is contained in:
parent
1d13565824
commit
b99a277595
12
packages/react-bootstrap-table2/src/caption.js
vendored
12
packages/react-bootstrap-table2/src/caption.js
vendored
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user