From 54064649ac271f99cf71a64d966fcf3ebd36f9a1 Mon Sep 17 00:00:00 2001 From: watashiwaaniket Date: Fri, 9 Jan 2026 12:27:23 +0530 Subject: [PATCH 1/5] Explorer can now hold components in it so that they can be visible from the menu drawer on mobile view --- quartz.layout.ts | 14 +++++++++++- quartz/components/Explorer.tsx | 40 +++++++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/quartz.layout.ts b/quartz.layout.ts index 970a5be34..3fb6cc09e 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -38,7 +38,19 @@ export const defaultContentPageLayout: PageLayout = { { Component: Component.ReaderMode() }, ], }), - Component.Explorer(), + Component.Explorer({ + folderDefaultState: "collapsed", + components: [ + { + Component: Component.RecentNotes(), + position: "before", + }, + { + Component: Component.ContentMeta(), + position: "after", + } + ] + }), ], right: [ Component.Graph(), diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index e4cbcabae..e16a5f460 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -20,6 +20,10 @@ export interface Options { filterFn: (node: FileTrieNode) => boolean mapFn: (node: FileTrieNode) => void order: OrderEntries[] + components?: { + Component: QuartzComponent + position: "before" | "after" + }[] } const defaultOptions: Options = { @@ -48,6 +52,7 @@ const defaultOptions: Options = { }, filterFn: (node) => node.slugSegment !== "tags", order: ["filter", "map", "sort"], + components: [], } export type FolderState = { @@ -60,9 +65,16 @@ export default ((userOpts?: Partial) => { const opts: Options = { ...defaultOptions, ...userOpts } const { OverflowList, overflowListAfterDOMLoaded } = OverflowListFactory() - const Explorer: QuartzComponent = ({ cfg, displayClass }: QuartzComponentProps) => { + const Explorer: QuartzComponent = ({ cfg, displayClass, ...props }: QuartzComponentProps) => { const id = `explorer-${numExplorers++}` + const beforeComponents = (opts.components || []).filter( + (c) => c.position === "before" || !c.position, + ) + const afterCOmpoentns = (opts.components || []).filter( + (c) => c.position === "after" || !c.position, + ) + return (
) => {
+ {beforeComponents.map((comp, idx) => ( +
+ +
+ ))} + + + {afterCOmpoentns.map((comp, idx) => ( +
+ +
+ ))}