mirror of
https://github.com/zadam/trilium.git
synced 2026-02-22 13:44:25 +01:00
fix(mobile/global_menu): tooltips not visible due to position
This commit is contained in:
parent
4ebc4ece34
commit
9fe7bdf79b
@ -3,11 +3,14 @@ import { createContext } from "preact";
|
||||
import { useContext } from "preact/hooks";
|
||||
|
||||
import FNote from "../../entities/fnote";
|
||||
import utils from "../../services/utils";
|
||||
import ActionButton, { ActionButtonProps } from "../react/ActionButton";
|
||||
import Dropdown, { DropdownProps } from "../react/Dropdown";
|
||||
import { useNoteLabel, useNoteProperty } from "../react/hooks";
|
||||
import Icon from "../react/Icon";
|
||||
|
||||
const cachedIsMobile = utils.isMobile();
|
||||
|
||||
export const LaunchBarContext = createContext<{
|
||||
isHorizontalLayout: boolean;
|
||||
}>({
|
||||
@ -26,7 +29,7 @@ export function LaunchBarActionButton({ className, ...props }: Omit<ActionButton
|
||||
<ActionButton
|
||||
className={clsx("button-widget launcher-button", className)}
|
||||
noIconActionClass
|
||||
titlePosition={isHorizontalLayout ? "bottom" : "right"}
|
||||
titlePosition={getTitlePosition(isHorizontalLayout)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
@ -34,6 +37,7 @@ export function LaunchBarActionButton({ className, ...props }: Omit<ActionButton
|
||||
|
||||
export function LaunchBarDropdownButton({ children, icon, dropdownOptions, ...props }: Pick<DropdownProps, "title" | "children" | "onShown" | "dropdownOptions" | "dropdownRef"> & { icon: string }) {
|
||||
const { isHorizontalLayout } = useContext(LaunchBarContext);
|
||||
const titlePosition = getTitlePosition(isHorizontalLayout);
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
@ -41,12 +45,12 @@ export function LaunchBarDropdownButton({ children, icon, dropdownOptions, ...pr
|
||||
buttonClassName="right-dropdown-button launcher-button"
|
||||
hideToggleArrow
|
||||
text={<Icon icon={icon} />}
|
||||
titlePosition={isHorizontalLayout ? "bottom" : "right"}
|
||||
titlePosition={titlePosition}
|
||||
titleOptions={{ animation: false }}
|
||||
dropdownOptions={{
|
||||
...dropdownOptions,
|
||||
popperConfig: {
|
||||
placement: isHorizontalLayout ? "bottom" : "right"
|
||||
placement: titlePosition
|
||||
}
|
||||
}}
|
||||
mobileBackdrop
|
||||
@ -67,3 +71,10 @@ export function useLauncherIconAndTitle(note: FNote) {
|
||||
title: title ?? ""
|
||||
};
|
||||
}
|
||||
|
||||
function getTitlePosition(isHorizontalLayout: boolean) {
|
||||
if (cachedIsMobile) {
|
||||
return "top";
|
||||
}
|
||||
return isHorizontalLayout ? "bottom" : "right";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user