import { Fragment } from "preact/jsx-runtime"; import "./Breadcrumb.css"; import { useChildNotes, useNoteContext } from "./react/hooks"; import NoteLink from "./react/NoteLink"; import Dropdown from "./react/Dropdown"; import Icon from "./react/Icon"; import { FormListItem } from "./react/FormList"; import NoteContext from "../components/note_context"; export default function Breadcrumb() { const { note, noteContext } = useNoteContext(); const notePath = buildNotePaths(noteContext?.notePathArray); return (
{notePath.map((item, index) => ( {(index < notePath.length - 1 || note?.hasChildren()) && } ))}
) } function BreadcrumbItem({ notePath, activeNotePath }: { notePath: string, activeNotePath: string }) { const isRootNote = (notePath === "root"); return ( ) } function BreadcrumbSeparator({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) { return ( } noSelectButtonStyle buttonClassName="icon-action" hideToggleArrow > ) } function BreadcrumbSeparatorDropdownContent({ notePath, noteContext, activeNotePath }: { notePath: string, activeNotePath: string, noteContext: NoteContext | undefined }) { const notePathComponents = notePath.split("/"); const notePathPrefix = notePathComponents.join("/"); // last item was removed already. const parentNoteId = notePathComponents.length > 1 ? notePathComponents.pop() : "root"; const childNotes = useChildNotes(parentNoteId); return ( ) } function buildNotePaths(notePathArray: string[] | undefined) { if (!notePathArray) return []; let prefix = ""; const output: string[] = []; for (const notePath of notePathArray) { output.push(`${prefix}${notePath}`); prefix += `${notePath}/`; } return output; }