From 52ef6d1b6f2c4be99426929fc98b17dc7e7e96fc Mon Sep 17 00:00:00 2001
From: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
Date: Tue, 06 Feb 2024 06:12:31 +0000
Subject: [PATCH] fix(search): set background-color for icon within preview panel (#815)
---
quartz/components/pages/FolderContent.tsx | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx
index 1acb98a..b954ea2 100644
--- a/quartz/components/pages/FolderContent.tsx
+++ b/quartz/components/pages/FolderContent.tsx
@@ -5,8 +5,8 @@
import { PageList } from "../PageList"
import { _stripSlashes, simplifySlug } from "../../util/path"
import { Root } from "hast"
-import { pluralize } from "../../util/lang"
import { htmlToJsx } from "../../util/jsx"
+import { i18n } from "../../i18n"
interface FolderContentOptions {
/**
@@ -20,11 +20,10 @@
}
export default ((opts?: Partial<FolderContentOptions>) => {
- // Merge options with defaults
const options: FolderContentOptions = { ...defaultOptions, ...opts }
function FolderContent(props: QuartzComponentProps) {
- const { tree, fileData, allFiles } = props
+ const { tree, fileData, allFiles, cfg } = props
const folderSlug = _stripSlashes(simplifySlug(fileData.slug!))
const allPagesInFolder = allFiles.filter((file) => {
const fileSlug = _stripSlashes(simplifySlug(file.slug!))
@@ -34,7 +33,8 @@
const isDirectChild = fileParts.length === folderParts.length + 1
return prefixed && isDirectChild
})
-
+ const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
+ const classes = ["popover-hint", ...cssClasses].join(" ")
const listProps = {
...props,
allFiles: allPagesInFolder,
@@ -46,13 +46,21 @@
: htmlToJsx(fileData.filePath!, tree)
return (
- <div class="popover-hint">
+ <div class={classes}>
<article>
<p>{content}</p>
</article>
- {options.showFolderCount && <p>{pluralize(allPagesInFolder.length, "item")} under this folder.</p>}
- <div>
- <PageList {...listProps} />
+ <div class="page-listing">
+ {options.showFolderCount && (
+ <p>
+ {i18n(cfg.locale).pages.folderContent.itemsUnderFolder({
+ count: allPagesInFolder.length,
+ })}
+ </p>
+ )}
+ <div>
+ <PageList {...listProps} />
+ </div>
</div>
</div>
)
--
Gitblit v1.10.0