Jacky Zhao
2023-07-13 906f91f8eed5e91a7afae95c7002a3e4553d6aae
quartz/components/pages/FolderContent.tsx
@@ -5,10 +5,11 @@
import style from '../styles/listPage.scss'
import { PageList } from "../PageList"
import { toServerSlug } from "../../path"
function TagContent(props: QuartzComponentProps) {
function FolderContent(props: QuartzComponentProps) {
  const { tree, fileData, allFiles } = props
  const folderSlug = fileData.slug!
  const folderSlug = toServerSlug(fileData.slug!)
  const allPagesInFolder = allFiles.filter(file => {
    const fileSlug = file.slug ?? ""
    const prefixed = fileSlug.startsWith(folderSlug)
@@ -25,13 +26,14 @@
  // @ts-ignore
  const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' })
  return <div>
  return <div class="popover-hint">
    <article>{content}</article>
    <p>{allPagesInFolder.length} items under this folder.</p>
    <div>
      <PageList {...listProps} /> 
    </div>
  </div>
}
TagContent.css = style + PageList.css
export default (() => TagContent) satisfies QuartzComponentConstructor
FolderContent.css = style + PageList.css
export default (() => FolderContent) satisfies QuartzComponentConstructor