Skip to content

Commit d707ca3

Browse files
authored
refactor(PopoverContent): rename to PopoverBody (react-bootstrap#5677)
1 parent f29ad48 commit d707ca3

13 files changed

+35
-71
lines changed

src/Popover.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
44
import isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';
55
import { useBootstrapPrefix } from './ThemeProvider';
66
import PopoverTitle from './PopoverTitle';
7-
import PopoverContent from './PopoverContent';
7+
import PopoverBody from './PopoverBody';
88
import { ArrowProps, Placement } from './Overlay';
99
import { BsPrefixProps } from './helpers';
1010

@@ -15,7 +15,7 @@ export interface PopoverProps
1515
placement?: Placement;
1616
title?: string;
1717
arrowProps?: ArrowProps;
18-
content?: boolean;
18+
body?: boolean;
1919
popper?: any;
2020
show?: boolean;
2121
}
@@ -69,10 +69,10 @@ const propTypes = {
6969
}),
7070

7171
/**
72-
* When this prop is set, it creates a Popover with a Popover.Content inside
72+
* When this prop is set, it creates a Popover with a Popover.Body inside
7373
* passing the children directly to it
7474
*/
75-
content: PropTypes.bool,
75+
body: PropTypes.bool,
7676

7777
/** @private */
7878
popper: PropTypes.object,
@@ -93,7 +93,7 @@ const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(
9393
className,
9494
style,
9595
children,
96-
content,
96+
body,
9797
arrowProps,
9898
popper: _,
9999
show: _1,
@@ -124,7 +124,7 @@ const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(
124124
{...props}
125125
>
126126
<div className="popover-arrow" {...arrowProps} />
127-
{content ? <PopoverContent>{children}</PopoverContent> : children}
127+
{body ? <PopoverBody>{children}</PopoverBody> : children}
128128
</div>
129129
);
130130
},
@@ -135,5 +135,5 @@ Popover.defaultProps = defaultProps;
135135

136136
export default Object.assign(Popover, {
137137
Title: PopoverTitle,
138-
Content: PopoverContent,
138+
Body: PopoverBody,
139139
});

src/PopoverBody.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import createWithBsPrefix from './createWithBsPrefix';
2+
3+
export default createWithBsPrefix('popover-body');

src/PopoverContent.tsx

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export { default as Popover } from './Popover';
144144
export type { PopoverProps } from './Popover';
145145

146146
export { default as PopoverTitle } from './PopoverTitle';
147-
export { default as PopoverContent } from './PopoverContent';
147+
export { default as PopoverBody } from './PopoverBody';
148148
export { default as ProgressBar } from './ProgressBar';
149149
export type { ProgressBarProps } from './ProgressBar';
150150

test/PopoverSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ describe('Popover', () => {
88
mount(
99
<Popover id="test-popover">
1010
<Popover.Title>Popover title</Popover.Title>
11-
<Popover.Content>
11+
<Popover.Body>
1212
<strong>Popover Content</strong>
13-
</Popover.Content>
13+
</Popover.Body>
1414
</Popover>,
1515
).assertSingle(
1616
'.popover[x-placement="right"][role="tooltip"].bs-popover-end strong',

tests/simple-types-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,9 @@ const MegaComponent = () => (
886886
<Popover.Title as="div" bsPrefix="prefix" style={style}>
887887
Popover title
888888
</Popover.Title>
889-
<Popover.Content as="div" bsPrefix="prefix" style={style}>
889+
<Popover.Body as="div" bsPrefix="prefix" style={style}>
890890
<strong>Popover Content</strong>
891-
</Popover.Content>
891+
</Popover.Body>
892892
</Popover>
893893
<div>
894894
<ProgressBar striped variant="success" min={-10} now={40} max={200} />

www/src/examples/Overlays/PopoverBasic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const popover = (
22
<Popover id="popover-basic">
33
<Popover.Title as="h3">Popover right</Popover.Title>
4-
<Popover.Content>
4+
<Popover.Body>
55
And here's some <strong>amazing</strong> content. It's very engaging.
66
right?
7-
</Popover.Content>
7+
</Popover.Body>
88
</Popover>
99
);
1010

www/src/examples/Overlays/PopoverContained.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ function Example() {
2121
>
2222
<Popover id="popover-contained">
2323
<Popover.Title as="h3">Popover bottom</Popover.Title>
24-
<Popover.Content>
24+
<Popover.Body>
2525
<strong>Holy guacamole!</strong> Check this info.
26-
</Popover.Content>
26+
</Popover.Body>
2727
</Popover>
2828
</Overlay>
2929
</div>

www/src/examples/Overlays/PopoverPositioned.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
overlay={
88
<Popover id={`popover-positioned-${placement}`}>
99
<Popover.Title as="h3">{`Popover ${placement}`}</Popover.Title>
10-
<Popover.Content>
10+
<Popover.Body>
1111
<strong>Holy guacamole!</strong> Check this info.
12-
</Popover.Content>
12+
</Popover.Body>
1313
</Popover>
1414
}
1515
>

www/src/examples/Overlays/PopoverPositionedScrolling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const popover = (position) => (
22
<Popover id={`popover-positioned-scrolling-${position}`}>
33
<Popover.Title as="h3">{`Popover ${position}`}</Popover.Title>
4-
<Popover.Content>
4+
<Popover.Body>
55
<strong>Holy guacamole!</strong> Check this info.
6-
</Popover.Content>
6+
</Popover.Body>
77
</Popover>
88
);
99

0 commit comments

Comments
 (0)