mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 13:51:48 +00:00
Added support for tag mode on short URLs list
This commit is contained in:
24
src/utils/TooltipToggleSwitch.tsx
Normal file
24
src/utils/TooltipToggleSwitch.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { FC, useRef } from 'react';
|
||||
import { UncontrolledTooltip } from 'reactstrap';
|
||||
import { UncontrolledTooltipProps } from 'reactstrap/lib/Tooltip';
|
||||
import { BooleanControlProps } from './BooleanControl';
|
||||
import ToggleSwitch from './ToggleSwitch';
|
||||
|
||||
export const TooltipToggleSwitch: FC<BooleanControlProps & { tooltip?: Omit<UncontrolledTooltipProps, 'target'> }> = (
|
||||
{ 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>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -25,3 +25,5 @@ export const supportsDomainRedirects = supportsQrErrorCorrection;
|
||||
export const supportsForwardQuery = serverMatchesVersions({ minVersion: '2.9.0' });
|
||||
|
||||
export const supportsDefaultDomainRedirectsEdition = serverMatchesVersions({ minVersion: '2.10.0' });
|
||||
|
||||
export const supportsAllTagsFiltering = serverMatchesVersions({ minVersion: '3.0.0' });
|
||||
|
||||
Reference in New Issue
Block a user