mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Remove useTooltip hook
This commit is contained in:
		@@ -5,8 +5,7 @@
 | 
			
		||||
 * See /LICENSE for more information.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { useState, useEffect, useRef } from "react";
 | 
			
		||||
import { Tooltip } from "bootstrap/dist/js/bootstrap.bundle.min";
 | 
			
		||||
import { useState, useEffect } from "react";
 | 
			
		||||
 | 
			
		||||
/** Execute callback when condition is set to true. */
 | 
			
		||||
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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user