1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-12-25 00:11:36 +01:00

Remove useTooltip hook

This commit is contained in:
Aleksandr Gumroian 2024-04-30 13:37:25 +02:00
parent 39257567d4
commit ff48d6ca36
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733
2 changed files with 2 additions and 22 deletions

View File

@ -69,7 +69,7 @@ export {
withErrorMessage, withErrorMessage,
} from "./utils/conditionalHOCs"; } from "./utils/conditionalHOCs";
export { ErrorMessage } from "./utils/ErrorMessage"; export { ErrorMessage } from "./utils/ErrorMessage";
export { useClickOutside, useTooltip } from "./utils/hooks"; export { useClickOutside } from "./utils/hooks";
export { toLocaleDateString } from "./utils/datetime"; export { toLocaleDateString } from "./utils/datetime";
export { displayCard } from "./utils/displayCard"; export { displayCard } from "./utils/displayCard";
export { isPluginInstalled } from "./utils/isPluginInstalled"; export { isPluginInstalled } from "./utils/isPluginInstalled";

View File

@ -5,8 +5,7 @@
* See /LICENSE for more information. * See /LICENSE for more information.
*/ */
import { useState, useEffect, useRef } from "react"; import { useState, useEffect } from "react";
import { Tooltip } from "bootstrap/dist/js/bootstrap.bundle.min";
/** Execute callback when condition is set to true. */ /** Execute callback when condition is set to true. */
export function useConditionalTimeout( export function useConditionalTimeout(
@ -41,22 +40,3 @@ export function useClickOutside(element, callback) {
}; };
}); });
} }
/** useTooltip hook for Bootstrap tooltips. */
export function useTooltip(description, placement = "top", trigger = "hover") {
const tooltipRef = useRef();
useEffect(() => {
const tooltip = new Tooltip(tooltipRef.current, {
title: description,
placement,
trigger,
});
return () => {
tooltip.dispose();
};
});
return tooltipRef;
}