mirror of
https://github.com/zadam/trilium.git
synced 2025-12-12 18:34:24 +01:00
feat(breadcrumb): start implementing interactive breadcrumbs
This commit is contained in:
parent
6e29fe8d58
commit
5f215b14c2
@ -1,4 +1,13 @@
|
|||||||
.component.breadcrumb {
|
.component.breadcrumb {
|
||||||
contain: none;
|
contain: none;
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 0.9em;
|
||||||
|
gap: 0.25em;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
|
import { Fragment } from "preact/jsx-runtime";
|
||||||
import "./Breadcrumb.css";
|
import "./Breadcrumb.css";
|
||||||
|
import ActionButton from "./react/ActionButton";
|
||||||
import { useNoteContext } from "./react/hooks";
|
import { useNoteContext } from "./react/hooks";
|
||||||
import NoteLink from "./react/NoteLink";
|
import NoteLink from "./react/NoteLink";
|
||||||
import { joinElements } from "./react/react_utils";
|
|
||||||
|
|
||||||
export default function Breadcrumb() {
|
export default function Breadcrumb() {
|
||||||
const { noteContext } = useNoteContext();
|
const { noteContext } = useNoteContext();
|
||||||
@ -9,9 +10,12 @@ export default function Breadcrumb() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="breadcrumb">
|
<div className="breadcrumb">
|
||||||
{joinElements(notePath.map(item => (
|
{notePath.map(item => (
|
||||||
<BreadcrumbItem key={item} notePath={item} />
|
<Fragment key={item}>
|
||||||
)), <> › </>)}
|
<BreadcrumbItem notePath={item} />
|
||||||
|
<BreadcrumbSeparator notePath={item} />
|
||||||
|
</Fragment>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -25,6 +29,15 @@ function BreadcrumbItem({ notePath }: { notePath: string }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function BreadcrumbSeparator({ notePath }: { notePath: string}) {
|
||||||
|
return (
|
||||||
|
<ActionButton
|
||||||
|
icon="bx bx-chevron-right"
|
||||||
|
text=""
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function buildNotePaths(notePathArray: string[] | undefined) {
|
function buildNotePaths(notePathArray: string[] | undefined) {
|
||||||
if (!notePathArray) return [];
|
if (!notePathArray) return [];
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user