feat(launch_bar): faster tooltips
Some checks are pending
Checks / main (push) Waiting to run

This commit is contained in:
Elian Doran 2025-12-05 12:12:02 +02:00
parent 3ad4ca3943
commit 57b8bc2645
No known key found for this signature in database
3 changed files with 8 additions and 4 deletions

View File

@ -36,6 +36,7 @@ export function LaunchBarDropdownButton({ children, icon, ...props }: Pick<Dropd
hideToggleArrow
text={<Icon icon={icon} />}
titlePosition={isHorizontalLayout ? "bottom" : "right"}
titleOptions={{ animation: false }}
{...props}
>{children}</Dropdown>
)

View File

@ -23,7 +23,8 @@ export default function ActionButton({ text, icon, className, triggerCommand, ti
useStaticTooltip(buttonRef, {
title: keyboardShortcut?.length ? `${text} (${keyboardShortcut?.join(",")})` : text,
placement: titlePosition ?? "bottom",
fallbackPlacements: [ titlePosition ?? "bottom" ]
fallbackPlacements: [ titlePosition ?? "bottom" ],
animation: false
});
useEffect(() => {

View File

@ -1,4 +1,4 @@
import { Dropdown as BootstrapDropdown } from "bootstrap";
import { Dropdown as BootstrapDropdown, Tooltip } from "bootstrap";
import { ComponentChildren, HTMLAttributes } from "preact";
import { CSSProperties, HTMLProps } from "preact/compat";
import { MutableRef, useCallback, useEffect, useRef, useState } from "preact/hooks";
@ -29,14 +29,16 @@ export interface DropdownProps extends Pick<HTMLProps<HTMLDivElement>, "id" | "c
dropdownOptions?: Partial<BootstrapDropdown.Options>;
dropdownRef?: MutableRef<BootstrapDropdown | null>;
titlePosition?: "top" | "right" | "bottom" | "left";
titleOptions?: Partial<Tooltip.Options>;
}
export default function Dropdown({ id, className, buttonClassName, isStatic, children, title, text, dropdownContainerStyle, dropdownContainerClassName, hideToggleArrow, iconAction, disabled, noSelectButtonStyle, noDropdownListStyle, forceShown, onShown: externalOnShown, onHidden: externalOnHidden, dropdownOptions, buttonProps, dropdownRef, titlePosition }: DropdownProps) {
export default function Dropdown({ id, className, buttonClassName, isStatic, children, title, text, dropdownContainerStyle, dropdownContainerClassName, hideToggleArrow, iconAction, disabled, noSelectButtonStyle, noDropdownListStyle, forceShown, onShown: externalOnShown, onHidden: externalOnHidden, dropdownOptions, buttonProps, dropdownRef, titlePosition, titleOptions }: DropdownProps) {
const containerRef = useRef<HTMLDivElement | null>(null);
const triggerRef = useRef<HTMLButtonElement | null>(null);
useStaticTooltip(triggerRef, {
...titleOptions,
placement: titlePosition ?? "bottom",
fallbackPlacements: [ titlePosition ?? "bottom" ]
fallbackPlacements: [ titlePosition ?? "bottom" ],
});
const [ shown, setShown ] = useState(false);