diff --git a/quartz/components/FolderList.tsx b/quartz/components/FolderList.tsx new file mode 100644 index 000000000..7a81e2600 --- /dev/null +++ b/quartz/components/FolderList.tsx @@ -0,0 +1,38 @@ +import path from "path" +import { resolveRelative, SimpleSlug } from "../util/path" +import { QuartzComponent, QuartzComponentProps } from "./types" + +type Props = { + limit?: number +} & QuartzComponentProps + +export const FolderList: QuartzComponent = ({ cfg, fileData, allFolders, limit }: Props) => { + let list: SimpleSlug[] = allFolders.sort(_alphabetical) + if (limit) { + list = list.slice(0, limit) + } + + return ( +
{allSubfolders.size === 1 ? "1 subfolder." : `${allSubfolders.size} subfolders.`}
+ )} +