mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
fix(react/global_menu): menu layout on mobile
This commit is contained in:
parent
5e4f529b26
commit
168ff90e38
@ -80,13 +80,13 @@ export default function Dropdown({ className, buttonClassName, isStatic, childre
|
||||
<span className="caret"></span>
|
||||
</button>
|
||||
|
||||
<div
|
||||
<ul
|
||||
class={`dropdown-menu ${isStatic ? "static" : ""} ${dropdownContainerClassName ?? ""} tn-dropdown-list`}
|
||||
style={dropdownContainerStyle}
|
||||
aria-labelledby={ariaId}
|
||||
>
|
||||
{shown && children}
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -97,8 +97,8 @@ const TOOLTIP_CONFIG: Partial<Tooltip.Options> = {
|
||||
fallbackPlacements: [ "right" ]
|
||||
}
|
||||
|
||||
export function FormListItem({ className, children, icon, value, title, active, badges, disabled, checked, onClick, description, selected, rtl, triggerCommand, outsideChildren }: FormListItemOpts) {
|
||||
const itemRef = useRef<HTMLAnchorElement>(null);
|
||||
export function FormListItem({ className, icon, value, title, active, disabled, checked, onClick, selected, rtl, triggerCommand, outsideChildren, description, ...contentProps }: FormListItemOpts) {
|
||||
const itemRef = useRef<HTMLLIElement>(null);
|
||||
|
||||
if (checked) {
|
||||
icon = "bx bx-check";
|
||||
@ -107,7 +107,7 @@ export function FormListItem({ className, children, icon, value, title, active,
|
||||
useStaticTooltip(itemRef, TOOLTIP_CONFIG);
|
||||
|
||||
return (
|
||||
<a
|
||||
<li
|
||||
ref={itemRef}
|
||||
class={`dropdown-item ${active ? "active" : ""} ${disabled ? "disabled" : ""} ${selected ? "selected" : ""} ${className ?? ""}`}
|
||||
data-value={value} title={title}
|
||||
@ -117,18 +117,28 @@ export function FormListItem({ className, children, icon, value, title, active,
|
||||
dir={rtl ? "rtl" : undefined}
|
||||
>
|
||||
<Icon icon={icon} />
|
||||
<div>
|
||||
{children}
|
||||
{badges && badges.map(({ className, text }) => (
|
||||
<span className={`badge ${className ?? ""}`}>{text}</span>
|
||||
))}
|
||||
{description && <div className="description">{description}</div>}
|
||||
</div>
|
||||
{description ? (
|
||||
<div>
|
||||
<FormListContent description={description} {...contentProps} />
|
||||
</div>
|
||||
) : (
|
||||
<FormListContent description={description} {...contentProps} />
|
||||
)}
|
||||
{outsideChildren}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function FormListContent({ children, badges, description }: Pick<FormListItemOpts, "children" | "badges" | "description">) {
|
||||
return <>
|
||||
{children}
|
||||
{badges && badges.map(({ className, text }) => (
|
||||
<span className={`badge ${className ?? ""}`}>{text}</span>
|
||||
))}
|
||||
{description && <div className="description">{description}</div>}
|
||||
</>;
|
||||
}
|
||||
|
||||
interface FormListHeaderOpts {
|
||||
text: string;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user