1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-06-16 13:46:16 +02:00

Update Bootstrap library to version 5.3.x

This commit is contained in:
Aleksandr Gumroian
2024-04-19 16:09:03 +02:00
parent 96785f0774
commit 42fcc02d83
22 changed files with 190 additions and 198 deletions

View File

@ -1,11 +1,12 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
*/
import { useState, useEffect } from "react";
import { useState, useEffect, useRef } from "react";
import { Tooltip } from "bootstrap/dist/js/bootstrap.bundle.min";
/** Execute callback when condition is set to true. */
export function useConditionalTimeout(
@ -40,3 +41,22 @@ 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;
}