mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 07:05:21 -04:00
26 lines
659 B
TypeScript
26 lines
659 B
TypeScript
"use client";
|
|
|
|
import { usePathname } from "next/navigation";
|
|
import clsx from "clsx";
|
|
import Link from "../Link";
|
|
import type { ComponentPropsWithoutRef } from "react";
|
|
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() || "";
|
|
|
|
return (
|
|
<h1 className={clsx(styles.title, className)} {...rest}>
|
|
<Link href={pathname as Route} underline={false} className={styles.link}>
|
|
{children}
|
|
</Link>
|
|
</h1>
|
|
);
|
|
};
|
|
|
|
export default PageTitle;
|