[WEB-1574] dev: page head hook (#4768)

* dev: page head custom hook added

* chore: code refactor
This commit is contained in:
Anmol Singh Bhatia 2024-06-11 23:17:39 +05:30 committed by GitHub
parent 3e34699194
commit 679db712cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,22 @@
import { useEffect } from "react";
import Head from "next/head";
interface IUseHeadParams {
title?: string;
}
const useHead = ({ title }: IUseHeadParams) => {
useEffect(() => {
if (title) {
document.title = title;
}
}, [title]);
return (
<Head>
<title>{title || "Plane | Simple, extensible, open-source project management tool."}</title>
</Head>
);
};
export default useHead;