mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-04-03 22:12:26 +02:00
37 lines
850 B
TypeScript
37 lines
850 B
TypeScript
import React, { useEffect, useRef } from "react";
|
|
|
|
import type { Nullable } from "@/types";
|
|
import { Helmet } from "react-helmet";
|
|
import * as styles from "./Page.module.scss";
|
|
|
|
interface Props {
|
|
title?: string;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
const Page: React.FC<Props> = ({ title, children }: Props) => {
|
|
const pageRef = useRef<Nullable<HTMLDivElement>>(null);
|
|
|
|
useEffect(() => {
|
|
if (pageRef.current) {
|
|
pageRef.current.scrollIntoView();
|
|
}
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
<Helmet>
|
|
<meta property="og:type" content="website" />
|
|
</Helmet>
|
|
<div ref={pageRef} className={styles.page}>
|
|
<div className={styles.inner}>
|
|
{title && <h1 className={styles.title}>{title}</h1>}
|
|
<div className={styles.body}>{children}</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Page;
|