File size: 438 Bytes
ec4551b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 'use client';
import { usePathname } from 'next/navigation';
import { useMemo } from 'react';
import { useMenuItem } from '@gitroom/frontend/components/layout/top.menu';
export const Title = () => {
const path = usePathname();
const { all: menuItems } = useMenuItem();
const currentTitle = useMemo(() => {
return menuItems.find((item) => path.indexOf(item.path) > -1)?.name;
}, [path]);
return <h1>{currentTitle}</h1>;
};
|