import "./BookmarkButtons.css"; import { CSSProperties } from "preact"; import { useContext, useMemo } from "preact/hooks"; import type FNote from "../../entities/fnote"; import { t } from "../../services/i18n"; import { FormDropdownSubmenu, FormListItem } from "../react/FormList"; import { useChildNotes, useNote, useNoteIcon, useNoteLabelBoolean } from "../react/hooks"; import NoteLink from "../react/NoteLink"; import ResponsiveContainer from "../react/ResponsiveContainer"; import { CustomNoteLauncher, launchCustomNoteLauncher } from "./GenericButtons"; import { LaunchBarContext, LaunchBarDropdownButton, useLauncherIconAndTitle } from "./launch_bar_widgets"; const PARENT_NOTE_ID = "_lbBookmarks"; export default function BookmarkButtons() { const { isHorizontalLayout } = useContext(LaunchBarContext); const style = useMemo(() => ({ display: "flex", flexDirection: isHorizontalLayout ? "row" : "column", contain: "none" }), [ isHorizontalLayout ]); const childNotes = useChildNotes(PARENT_NOTE_ID); return ( {childNotes?.map(childNote => )} } mobile={ {childNotes?.map(childNote => )} } /> ); } function SingleBookmark({ note }: { note: FNote }) { const [ bookmarkFolder ] = useNoteLabelBoolean(note, "bookmarkFolder"); return : note.noteId} /> } mobile={} />; } function MobileBookmarkItem({ noteId, bookmarkFolder }: { noteId: string, bookmarkFolder: boolean }) { const note = useNote(noteId); const noteIcon = useNoteIcon(note); if (!note) return null; return ( !bookmarkFolder ? launchCustomNoteLauncher(e, { launcherNote: note, getTargetNoteId: () => note.noteId })}>{note.title} : ); } function MobileBookmarkFolder({ note }: { note: FNote }) { const childNotes = useChildNotes(note.noteId); return ( {childNotes.map(childNote => ( launchCustomNoteLauncher(e, { launcherNote: childNote, getTargetNoteId: () => childNote.noteId })} > {childNote.title} ))} ); } function BookmarkFolder({ note }: { note: FNote }) { const { icon, title } = useLauncherIconAndTitle(note); const childNotes = useChildNotes(note.noteId); return (
    {childNotes.map(childNote => (
  • ))}
); }