1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 07:01:19 -04:00

custom <Link /> wrapper around next/link

This commit is contained in:
2022-01-30 10:33:40 -05:00
parent 2a29d713bb
commit 9f34cec930
35 changed files with 578 additions and 1009 deletions

View File

@@ -2,23 +2,22 @@ import { useRouter } from "next/router";
import Link from "next/link";
import classNames from "classnames";
import { baseUrl } from "../../lib/config";
import type { ReactNode } from "react";
import type { PropsWithChildren } from "react";
import styles from "./PageTitle.module.css";
type Props = {
children: ReactNode;
type Props = PropsWithChildren<{
className?: string;
};
}>;
const PageTitle = ({ children, className }: Props) => {
const PageTitle = ({ className, ...rest }: Props) => {
const router = useRouter();
const canonical = `${baseUrl}${router.pathname}/`;
return (
<h1 className={classNames(styles.title, className)}>
<Link href={canonical}>
<a>{children}</a>
<a {...rest} />
</Link>
</h1>
);