mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
[WEB-1574] dev: page head hook (#4768)
* dev: page head custom hook added * chore: code refactor
This commit is contained in:
parent
3e34699194
commit
679db712cf
22
web/core/hooks/use-page-title.tsx
Normal file
22
web/core/hooks/use-page-title.tsx
Normal 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;
|
Loading…
Reference in New Issue
Block a user