mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
9522c59674
* minor archive table updates * archived date cell * archive import paths * move project health table files * fix: align actions cells * simplify health table row mapping * fix project pages browser tab title * initial draft of virtualized table component * refactor: virtualized table common component * fix: health report name cell width * refactor: report cell paths
24 lines
675 B
TypeScript
24 lines
675 B
TypeScript
import { useEffect, useContext } from 'react';
|
|
import { AnnouncerContext } from 'component/common/Announcer/AnnouncerContext/AnnouncerContext';
|
|
|
|
export const usePageTitle = (title?: string) => {
|
|
const { setAnnouncement } = useContext(AnnouncerContext);
|
|
|
|
useEffect(() => {
|
|
if (title) {
|
|
document.title = title;
|
|
return () => {
|
|
document.title = DEFAULT_PAGE_TITLE;
|
|
};
|
|
}
|
|
}, [title]);
|
|
|
|
useEffect(() => {
|
|
if (title && title !== DEFAULT_PAGE_TITLE) {
|
|
setAnnouncement(`Navigated to ${title}`);
|
|
}
|
|
}, [setAnnouncement, title]);
|
|
};
|
|
|
|
const DEFAULT_PAGE_TITLE = 'Unleash';
|