my_digital_garden/quartz/components/Header.tsx

21 lines
490 B
TypeScript
Raw Normal View History

2023-06-02 00:05:14 +01:00
import { resolveToRoot } from "../path"
2023-06-07 03:48:37 +01:00
import Darkmode from "./Darkmode"
2023-06-07 05:19:00 +01:00
import style from './styles/header.scss'
2023-06-02 00:05:14 +01:00
export interface HeaderProps {
title: string
slug: string
}
2023-06-07 03:48:37 +01:00
export default function Header({ title, slug }: HeaderProps) {
2023-06-02 00:05:14 +01:00
const baseDir = resolveToRoot(slug)
return <header>
<h1><a href={baseDir}>{title}</a></h1>
2023-06-07 03:48:37 +01:00
<div class="spacer"></div>
<Darkmode />
2023-06-02 00:05:14 +01:00
</header>
}
2023-06-03 20:07:19 +01:00
2023-06-07 03:48:37 +01:00
Header.beforeDOMLoaded = Darkmode.beforeDOMLoaded
Header.css = style + Darkmode.css