Skip to content

Commit

Permalink
fix: add tooltip to button
Browse files Browse the repository at this point in the history
  • Loading branch information
richardmichel committed May 29, 2023
1 parent 7699b96 commit 6ef0105
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ const defaultProps = {
const useTooltip = (tooltip: any) => {
if (!tooltip) {
return {
tooltipOpen: null,
tooltipOpen: false,
setTooltipOpen: null,
toggle: null,
toggle: () => {},
tooltipId: null,
};
}
Expand Down Expand Up @@ -266,7 +266,6 @@ export const Button: BsPrefixRefForwardingComponent<'button', ButtonProps> =
</Component>

{tooltip && tooltipId && (
// @ts-ignore
<Tooltip2
placement={'top'}
isOpen={tooltipOpen}
Expand Down
6 changes: 6 additions & 0 deletions src/components/Tooltip2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@ export interface ITooltipProps {
trigger?: string;
popperClassName?: any;
innerClassName?: any;
children: React.ReactElement;
isOpen?: boolean;
target?: any;
toggle?: () => void;
}

export const Tooltip2: React.FC<ITooltipProps> = ({
placement = 'top',
autohide = true,
placementPrefix = 'bs-tooltip',
trigger = 'hover focus',
children,
...propsMain
}) => {
const props = {
placement,
autohide,
placementPrefix,
trigger,
children,
...propsMain,
};
const popperClasses = classNames('tooltip', 'show', props.popperClassName);
Expand Down

0 comments on commit 6ef0105

Please sign in to comment.