diff --git a/quartz/components/DesktopOnly.tsx b/quartz/components/DesktopOnly.tsx
index a11f23fa..fe2a27f1 100644
--- a/quartz/components/DesktopOnly.tsx
+++ b/quartz/components/DesktopOnly.tsx
@@ -3,7 +3,7 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } fro
export default ((component?: QuartzComponent) => {
if (component) {
const Component = component
- function DesktopOnly(props: QuartzComponentProps) {
+ const DesktopOnly: QuartzComponent = (props: QuartzComponentProps) => {
return
}
diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx
index f7017342..cffc079e 100644
--- a/quartz/components/Explorer.tsx
+++ b/quartz/components/Explorer.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import explorerStyle from "./styles/explorer.scss"
// @ts-ignore
@@ -75,7 +75,12 @@ export default ((userOpts?: Partial
) => {
jsonTree = JSON.stringify(folders)
}
- function Explorer({ cfg, allFiles, displayClass, fileData }: QuartzComponentProps) {
+ const Explorer: QuartzComponent = ({
+ cfg,
+ allFiles,
+ displayClass,
+ fileData,
+ }: QuartzComponentProps) => {
constructFileTree(allFiles)
return (
diff --git a/quartz/components/Footer.tsx b/quartz/components/Footer.tsx
index de472f72..076c3787 100644
--- a/quartz/components/Footer.tsx
+++ b/quartz/components/Footer.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/footer.scss"
import { version } from "../../package.json"
import { i18n } from "../i18n"
@@ -8,7 +8,7 @@ interface Options {
}
export default ((opts?: Options) => {
- function Footer({ displayClass, cfg }: QuartzComponentProps) {
+ const Footer: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const year = new Date().getFullYear()
const links = opts?.links ?? []
return (
diff --git a/quartz/components/Graph.tsx b/quartz/components/Graph.tsx
index 9fce9bd8..40ab43a2 100644
--- a/quartz/components/Graph.tsx
+++ b/quartz/components/Graph.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
// @ts-ignore
import script from "./scripts/graph.inline"
import style from "./styles/graph.scss"
@@ -54,7 +54,7 @@ const defaultOptions: GraphOptions = {
}
export default ((opts?: GraphOptions) => {
- function Graph({ displayClass, cfg }: QuartzComponentProps) {
+ const Graph: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph }
const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph }
return (
diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx
index 8292acc0..a3c0800a 100644
--- a/quartz/components/Head.tsx
+++ b/quartz/components/Head.tsx
@@ -1,10 +1,10 @@
import { i18n } from "../i18n"
import { FullSlug, joinSegments, pathToRoot } from "../util/path"
import { JSResourceToScriptElement } from "../util/resources"
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
export default (() => {
- function Head({ cfg, fileData, externalResources }: QuartzComponentProps) {
+ const Head: QuartzComponent = ({ cfg, fileData, externalResources }: QuartzComponentProps) => {
const title = fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title
const description =
fileData.description?.trim() ?? i18n(cfg.locale).propertyDefaults.description
diff --git a/quartz/components/Header.tsx b/quartz/components/Header.tsx
index 5281f729..eba17ae0 100644
--- a/quartz/components/Header.tsx
+++ b/quartz/components/Header.tsx
@@ -1,6 +1,6 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
-function Header({ children }: QuartzComponentProps) {
+const Header: QuartzComponent = ({ children }: QuartzComponentProps) => {
return children.length > 0 ? : null
}
diff --git a/quartz/components/MobileOnly.tsx b/quartz/components/MobileOnly.tsx
index 5a190957..7d2108de 100644
--- a/quartz/components/MobileOnly.tsx
+++ b/quartz/components/MobileOnly.tsx
@@ -3,7 +3,7 @@ import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } fro
export default ((component?: QuartzComponent) => {
if (component) {
const Component = component
- function MobileOnly(props: QuartzComponentProps) {
+ const MobileOnly: QuartzComponent = (props: QuartzComponentProps) => {
return
}
diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx
index 644e354c..62b77b17 100644
--- a/quartz/components/PageList.tsx
+++ b/quartz/components/PageList.tsx
@@ -1,7 +1,7 @@
import { FullSlug, resolveRelative } from "../util/path"
import { QuartzPluginData } from "../plugins/vfile"
import { Date, getDate } from "./Date"
-import { QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentProps } from "./types"
import { GlobalConfiguration } from "../cfg"
export function byDateAndAlphabetical(
@@ -29,7 +29,7 @@ type Props = {
limit?: number
} & QuartzComponentProps
-export function PageList({ cfg, fileData, allFiles, limit }: Props) {
+export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit }: Props) => {
let list = allFiles.sort(byDateAndAlphabetical(cfg))
if (limit) {
list = list.slice(0, limit)
diff --git a/quartz/components/PageTitle.tsx b/quartz/components/PageTitle.tsx
index d1296026..2362f102 100644
--- a/quartz/components/PageTitle.tsx
+++ b/quartz/components/PageTitle.tsx
@@ -1,9 +1,9 @@
import { pathToRoot } from "../util/path"
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { classNames } from "../util/lang"
import { i18n } from "../i18n"
-function PageTitle({ fileData, cfg, displayClass }: QuartzComponentProps) {
+const PageTitle: QuartzComponent = ({ fileData, cfg, displayClass }: QuartzComponentProps) => {
const title = cfg?.pageTitle ?? i18n(cfg.locale).propertyDefaults.title
const baseDir = pathToRoot(fileData.slug!)
return (
diff --git a/quartz/components/RecentNotes.tsx b/quartz/components/RecentNotes.tsx
index f8f6de41..549b025d 100644
--- a/quartz/components/RecentNotes.tsx
+++ b/quartz/components/RecentNotes.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { FullSlug, SimpleSlug, resolveRelative } from "../util/path"
import { QuartzPluginData } from "../plugins/vfile"
import { byDateAndAlphabetical } from "./PageList"
@@ -24,7 +24,12 @@ const defaultOptions = (cfg: GlobalConfiguration): Options => ({
})
export default ((userOpts?: Partial) => {
- function RecentNotes({ allFiles, fileData, displayClass, cfg }: QuartzComponentProps) {
+ const RecentNotes: QuartzComponent = ({
+ allFiles,
+ fileData,
+ displayClass,
+ cfg,
+ }: QuartzComponentProps) => {
const opts = { ...defaultOptions(cfg), ...userOpts }
const pages = allFiles.filter(opts.filter).sort(opts.sort)
const remaining = Math.max(0, pages.length - opts.limit)
diff --git a/quartz/components/Search.tsx b/quartz/components/Search.tsx
index a07dbc4f..01e5a353 100644
--- a/quartz/components/Search.tsx
+++ b/quartz/components/Search.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/search.scss"
// @ts-ignore
import script from "./scripts/search.inline"
@@ -14,7 +14,7 @@ const defaultOptions: SearchOptions = {
}
export default ((userOpts?: Partial) => {
- function Search({ displayClass, cfg }: QuartzComponentProps) {
+ const Search: QuartzComponent = ({ displayClass, cfg }: QuartzComponentProps) => {
const opts = { ...defaultOptions, ...userOpts }
const searchPlaceholder = i18n(cfg.locale).components.search.searchBarPlaceholder
return (
diff --git a/quartz/components/TableOfContents.tsx b/quartz/components/TableOfContents.tsx
index 2abc74b5..77ff0eb1 100644
--- a/quartz/components/TableOfContents.tsx
+++ b/quartz/components/TableOfContents.tsx
@@ -1,4 +1,4 @@
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import legacyStyle from "./styles/legacyToc.scss"
import modernStyle from "./styles/toc.scss"
import { classNames } from "../util/lang"
@@ -15,7 +15,11 @@ const defaultOptions: Options = {
layout: "modern",
}
-function TableOfContents({ fileData, displayClass, cfg }: QuartzComponentProps) {
+const TableOfContents: QuartzComponent = ({
+ fileData,
+ displayClass,
+ cfg,
+}: QuartzComponentProps) => {
if (!fileData.toc) {
return null
}
@@ -56,7 +60,7 @@ function TableOfContents({ fileData, displayClass, cfg }: QuartzComponentProps)
TableOfContents.css = modernStyle
TableOfContents.afterDOMLoaded = script
-function LegacyTableOfContents({ fileData, cfg }: QuartzComponentProps) {
+const LegacyTableOfContents: QuartzComponent = ({ fileData, cfg }: QuartzComponentProps) => {
if (!fileData.toc) {
return null
}
diff --git a/quartz/components/TagList.tsx b/quartz/components/TagList.tsx
index e5dd1a3a..04a483b6 100644
--- a/quartz/components/TagList.tsx
+++ b/quartz/components/TagList.tsx
@@ -1,8 +1,8 @@
import { pathToRoot, slugTag } from "../util/path"
-import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
+import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { classNames } from "../util/lang"
-function TagList({ fileData, displayClass }: QuartzComponentProps) {
+const TagList: QuartzComponent = ({ fileData, displayClass }: QuartzComponentProps) => {
const tags = fileData.frontmatter?.tags
const baseDir = pathToRoot(fileData.slug!)
if (tags && tags.length > 0) {