Skip to content

Commit

Permalink
fix(Tooltip): *-start and *-end placements work correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Jul 9, 2020
1 parent 77f105a commit 1c99fec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@ const Popover: Popover = (React.forwardRef<HTMLDivElement, PopoverProps>(
ref,
) => {
const decoratedBsPrefix = useBootstrapPrefix(bsPrefix, 'popover');
const [primaryPlacement] = placement?.split('-') || [];

return (
<div
ref={ref}
role="tooltip"
style={style}
x-placement={placement}
x-placement={primaryPlacement}
className={classNames(
className,
decoratedBsPrefix,
`bs-popover-${placement}`,
`bs-popover-${primaryPlacement}`,
)}
{...props}
>
Expand Down
10 changes: 8 additions & 2 deletions src/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ const Tooltip: Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
) => {
bsPrefix = useBootstrapPrefix(bsPrefix, 'tooltip');

const [primaryPlacement] = placement?.split('-') || [];

return (
<div
ref={ref}
style={style}
role="tooltip"
x-placement={placement}
className={classNames(className, bsPrefix, `bs-tooltip-${placement}`)}
x-placement={primaryPlacement}
className={classNames(
className,
bsPrefix,
`bs-tooltip-${primaryPlacement}`,
)}
{...props}
>
<div className="arrow" {...arrowProps} />
Expand Down

0 comments on commit 1c99fec

Please sign in to comment.