mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 13:51:48 +00:00
Updated to ExternalLink 2.0
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user