rizaldy.club/quartz/components/Header.tsx

21 lines
491 B
TypeScript
Raw Normal View History

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