mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 10:24:23 +01:00
chore(breadcrumbs): address requested changes
This commit is contained in:
parent
658b699b71
commit
4d75221938
@ -38,7 +38,7 @@ export default function Breadcrumb() {
|
|||||||
{notePath.slice(-FINAL_ITEMS).map((item, index) => (
|
{notePath.slice(-FINAL_ITEMS).map((item, index) => (
|
||||||
<Fragment key={item}>
|
<Fragment key={item}>
|
||||||
<BreadcrumbSeparator notePath={notePath[notePath.length - FINAL_ITEMS - (1 - index)]} activeNotePath={item} noteContext={noteContext} />
|
<BreadcrumbSeparator notePath={notePath[notePath.length - FINAL_ITEMS - (1 - index)]} activeNotePath={item} noteContext={noteContext} />
|
||||||
<BreadcrumbItem notePath={item} activeNotePath={noteContext?.notePath ?? ""} />
|
<BreadcrumbItem notePath={item} />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
@ -47,7 +47,7 @@ export default function Breadcrumb() {
|
|||||||
<Fragment key={item}>
|
<Fragment key={item}>
|
||||||
{index === 0
|
{index === 0
|
||||||
? <BreadcrumbRoot noteContext={noteContext} />
|
? <BreadcrumbRoot noteContext={noteContext} />
|
||||||
: <BreadcrumbItem notePath={item} activeNotePath={noteContext?.notePath ?? ""} />
|
: <BreadcrumbItem notePath={item} />
|
||||||
}
|
}
|
||||||
{(index < notePath.length - 1 || note?.hasChildren()) &&
|
{(index < notePath.length - 1 || note?.hasChildren()) &&
|
||||||
<BreadcrumbSeparator notePath={item} activeNotePath={notePath[index + 1]} noteContext={noteContext} />}
|
<BreadcrumbSeparator notePath={item} activeNotePath={notePath[index + 1]} noteContext={noteContext} />}
|
||||||
@ -76,14 +76,11 @@ function BreadcrumbRoot({ noteContext }: { noteContext: NoteContext | undefined
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function BreadcrumbItem({ notePath, activeNotePath }: { notePath: string, activeNotePath: string }) {
|
function BreadcrumbItem({ notePath }: { notePath: string }) {
|
||||||
const isRootNote = (notePath === "root");
|
|
||||||
return (
|
return (
|
||||||
<NoteLink
|
<NoteLink
|
||||||
notePath={notePath}
|
notePath={notePath}
|
||||||
noPreview
|
noPreview
|
||||||
title={isRootNote && activeNotePath !== "root" ? "" : undefined}
|
|
||||||
showNoteIcon={isRootNote}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -104,14 +101,13 @@ function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePa
|
|||||||
|
|
||||||
function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) {
|
function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) {
|
||||||
const notePathComponents = notePath.split("/");
|
const notePathComponents = notePath.split("/");
|
||||||
const notePathPrefix = notePathComponents.join("/");
|
|
||||||
const parentNoteId = notePathComponents.at(-1);
|
const parentNoteId = notePathComponents.at(-1);
|
||||||
const childNotes = useChildNotes(parentNoteId);
|
const childNotes = useChildNotes(parentNoteId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul class="breadcrumb-child-list">
|
<ul className="breadcrumb-child-list">
|
||||||
{childNotes.map((note) => {
|
{childNotes.map((note) => {
|
||||||
const childNotePath = `${notePathPrefix}/${note.noteId}`;
|
const childNotePath = `${notePath}/${note.noteId}`;
|
||||||
return <li key={note.noteId}>
|
return <li key={note.noteId}>
|
||||||
<FormListItem
|
<FormListItem
|
||||||
icon={note.getIcon()}
|
icon={note.getIcon()}
|
||||||
@ -136,7 +132,7 @@ function BreadcrumbCollapsed({ items, noteContext }: { items: string[], noteCont
|
|||||||
hideToggleArrow
|
hideToggleArrow
|
||||||
dropdownOptions={{ popperConfig: { strategy: "fixed" } }}
|
dropdownOptions={{ popperConfig: { strategy: "fixed" } }}
|
||||||
>
|
>
|
||||||
<ul class="breadcrumb-child-list">
|
<ul className="breadcrumb-child-list">
|
||||||
{items.map((notePath) => {
|
{items.map((notePath) => {
|
||||||
const notePathComponents = notePath.split("/");
|
const notePathComponents = notePath.split("/");
|
||||||
const noteId = notePathComponents[notePathComponents.length - 1];
|
const noteId = notePathComponents[notePathComponents.length - 1];
|
||||||
|
|||||||
@ -49,9 +49,8 @@ export default class ContentHeader extends Container<BasicWidget> {
|
|||||||
|
|
||||||
if (hasMovedEnough) {
|
if (hasMovedEnough) {
|
||||||
this.setFloating(isScrollingUp);
|
this.setFloating(isScrollingUp);
|
||||||
this.previousScrollTop = currentScrollTop;
|
|
||||||
}
|
}
|
||||||
|
this.previousScrollTop = currentScrollTop;
|
||||||
this.updateSafeMargin();
|
this.updateSafeMargin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user