Updated to ExternalLink 2.0

This commit is contained in:
Alejandro Celaya
2022-05-14 12:51:36 +02:00
parent a7cc8786c3
commit e387706a7b
4 changed files with 10 additions and 73 deletions

View File

@@ -1,25 +0,0 @@
import { FC, PropsWithChildren, useRef } from 'react';
import { UncontrolledTooltip, UncontrolledTooltipProps } from 'reactstrap';
import { BooleanControlProps } from './BooleanControl';
import ToggleSwitch from './ToggleSwitch';
export type TooltipToggleSwitchProps = BooleanControlProps & PropsWithChildren<{
tooltip?: Omit<UncontrolledTooltipProps, 'target'>;
}>;
export const TooltipToggleSwitch: FC<TooltipToggleSwitchProps> = ({ children, tooltip = {}, ...rest }) => {
const ref = useRef<HTMLSpanElement>();
return (
<>
<span
ref={(el) => {
ref.current = el ?? undefined;
}}
>
<ToggleSwitch {...rest} />
</span>
<UncontrolledTooltip target={(() => ref.current) as any} {...tooltip}>{children}</UncontrolledTooltip>
</>
);
};