1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-30 22:25:58 -04:00

fresh <PageTitle> look

This commit is contained in:
2025-03-08 13:09:29 -05:00
parent 5cfa86f690
commit 2d6fc82f71
29 changed files with 346 additions and 401 deletions
+5 -8
View File
@@ -1,6 +1,3 @@
"use client";
import { usePathname } from "next/navigation";
import clsx from "clsx";
import Link from "../Link";
import type { ComponentPropsWithoutRef } from "react";
@@ -8,14 +5,14 @@ import type { Route } from "next";
import styles from "./PageTitle.module.css";
export type PageTitleProps = ComponentPropsWithoutRef<"h1">;
const PageTitle = ({ className, children, ...rest }: PageTitleProps) => {
const pathname = usePathname() || "";
export type PageTitleProps = ComponentPropsWithoutRef<"h1"> & {
canonical: string;
};
const PageTitle = ({ canonical, className, children, ...rest }: PageTitleProps) => {
return (
<h1 className={clsx(styles.title, className)} {...rest}>
<Link href={pathname as Route} plain className={styles.link}>
<Link href={canonical as Route} plain className={styles.slug}>
{children}
</Link>
</h1>