1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 14:08:29 -04:00
jarv.is/components/PageTitle/PageTitle.tsx

37 lines
763 B
TypeScript

import { useRouter } from "next/router";
import Link from "../Link";
import { styled, theme } from "../../lib/styles/stitches.config";
import type { ComponentProps } from "react";
const Title = styled("h1", {
marginTop: 0,
marginBottom: "0.6em",
fontSize: "2em",
fontWeight: 600,
textAlign: "center",
"@medium": {
fontSize: "1.8em",
},
});
const TitleLink = styled(Link, {
color: theme.colors.text,
});
export type PageTitleProps = ComponentProps<typeof Title>;
const PageTitle = ({ children, ...rest }: PageTitleProps) => {
const router = useRouter(true);
return (
<Title {...rest}>
<TitleLink href={router.pathname} underline={false}>
{children}
</TitleLink>
</Title>
);
};
export default PageTitle;