chore: update type error

Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Aaron Pham 2025-02-25 16:42:39 -05:00
parent 235b7ab72c
commit e47a7c187f
No known key found for this signature in database
GPG Key ID: 18974753009D2BFA
3 changed files with 8 additions and 3 deletions

View File

@ -1,8 +1,9 @@
import { ComponentChildren } from "preact"
import { htmlToJsx } from "../../util/jsx"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../types"
const Content: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) => {
const content = htmlToJsx(fileData.filePath!, tree)
const content = htmlToJsx(fileData.filePath!, tree) as ComponentChildren
const classes: string[] = fileData.frontmatter?.cssclasses ?? []
const classString = ["popover-hint", ...classes].join(" ")
return <article class={classString}>{content}</article>

View File

@ -8,6 +8,7 @@ import { Root } from "hast"
import { htmlToJsx } from "../../util/jsx"
import { i18n } from "../../i18n"
import { QuartzPluginData } from "../../plugins/vfile"
import { ComponentChildren } from "preact"
interface FolderContentOptions {
/**
@ -78,10 +79,11 @@ export default ((opts?: Partial<FolderContentOptions>) => {
allFiles: allPagesInFolder,
}
const content =
const content = (
(tree as Root).children.length === 0
? fileData.description
: htmlToJsx(fileData.filePath!, tree)
) as ComponentChildren
return (
<div class="popover-hint">

View File

@ -6,6 +6,7 @@ import { QuartzPluginData } from "../../plugins/vfile"
import { Root } from "hast"
import { htmlToJsx } from "../../util/jsx"
import { i18n } from "../../i18n"
import { ComponentChildren } from "preact"
interface TagContentOptions {
sort?: SortFn
@ -33,10 +34,11 @@ export default ((opts?: Partial<TagContentOptions>) => {
(file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(tag),
)
const content =
const content = (
(tree as Root).children.length === 0
? fileData.description
: htmlToJsx(fileData.filePath!, tree)
) as ComponentChildren
const cssClasses: string[] = fileData.frontmatter?.cssclasses ?? []
const classes = cssClasses.join(" ")
if (tag === "/") {