mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-01-11 03:02:56 -05:00
remove unnecessary react fragments
This commit is contained in:
18
components/PageTitle/PageTitle.module.css
Normal file
18
components/PageTitle/PageTitle.module.css
Normal file
@@ -0,0 +1,18 @@
|
||||
.title {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.6em;
|
||||
font-size: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.title a {
|
||||
background: none;
|
||||
padding-bottom: 0;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.title {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
}
|
||||
24
components/PageTitle/PageTitle.tsx
Normal file
24
components/PageTitle/PageTitle.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { memo } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import Link from "next/link";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import styles from "./PageTitle.module.css";
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
const PageTitle = ({ children }: Props) => {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<h1 className={styles.title}>
|
||||
<Link href={router.asPath}>
|
||||
<a>{children}</a>
|
||||
</Link>
|
||||
</h1>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(PageTitle);
|
||||
Reference in New Issue
Block a user