inline scripts
This commit is contained in:
@ -8,10 +8,9 @@ export interface HeadProps {
|
||||
externalResources: StaticResources
|
||||
}
|
||||
|
||||
export default function({ title, description, slug, externalResources }: HeadProps) {
|
||||
export function Component({ title, description, slug, externalResources }: HeadProps) {
|
||||
const { css, js } = externalResources
|
||||
const baseDir = resolveToRoot(slug)
|
||||
const stylePath = baseDir + "/index.css"
|
||||
const iconPath = baseDir + "/static/icon.png"
|
||||
const ogImagePath = baseDir + "/static/og-image.png"
|
||||
return <head>
|
||||
@ -28,16 +27,7 @@ export default function({ title, description, slug, externalResources }: HeadPro
|
||||
<meta name="generator" content="Quartz" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
||||
<link rel="stylesheet" type="text/css" href={stylePath} />
|
||||
{css.map(href => <link key={href} href={href} rel="stylesheet" type="text/css" />)}
|
||||
{js.filter(resource => resource.loadTime === "beforeDOMReady").map(resource => <script key={resource.src} src={resource.src} />)}
|
||||
{js.filter(resource => resource.loadTime === "beforeDOMReady").map(resource => <script key={resource.src} {...resource} />)}
|
||||
</head>
|
||||
}
|
||||
|
||||
export function beforeDOMLoaded() {
|
||||
|
||||
}
|
||||
|
||||
export function onDOMLoaded() {
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ export interface HeaderProps {
|
||||
slug: string
|
||||
}
|
||||
|
||||
export default function({ title, slug }: HeaderProps) {
|
||||
export function Component({ title, slug }: HeaderProps) {
|
||||
const baseDir = resolveToRoot(slug)
|
||||
return <header>
|
||||
<h1><a href={baseDir}>{title}</a></h1>
|
||||
</header>
|
||||
|
||||
}
|
||||
|
||||
|
3
quartz/components/scripts/darkmode.inline.ts
Normal file
3
quartz/components/scripts/darkmode.inline.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default "Darkmode"
|
||||
|
||||
console.log("HELLOOOO FROM CONSOLE")
|
8
quartz/components/types.ts
Normal file
8
quartz/components/types.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { ComponentType } from "preact"
|
||||
|
||||
export type QuartzComponent<Props> = {
|
||||
Component: ComponentType<Props>
|
||||
css?: string,
|
||||
beforeDOMLoaded?: string,
|
||||
afterDOMLoaded?: string,
|
||||
}
|
Reference in New Issue
Block a user