diff --git a/index.html b/index.html index 6bdf706..634dc06 100644 --- a/index.html +++ b/index.html @@ -5,9 +5,9 @@ - + - Vitamin + Aha Front-End Assessment diff --git a/package.json b/package.json index 2354ced..e984a73 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "vitamin", + "name": "aha-frontend-assessment", "license": "MIT", "private": true, "version": "0.0.0", diff --git a/src/components/common/NavBar/NavBar.tsx b/src/components/common/NavBar/NavBar.tsx index 4c33efb..b23098a 100644 --- a/src/components/common/NavBar/NavBar.tsx +++ b/src/components/common/NavBar/NavBar.tsx @@ -1,7 +1,7 @@ import { hasTagsNotificationAtom } from 'atoms/core' import { useAtom } from 'jotai' import { useEffect, type ReactElement } from 'react' -import { Link, useLocation } from 'react-router-dom' +import { Link, useLocation, useSearchParams } from 'react-router-dom' import cn from 'utils/cn' import ArrowBackSvg from '../../../icons/ArrowBack.svg?react' import Logo from '../Logo' @@ -9,6 +9,7 @@ import NavButton from './NavButton' export default function NavBar(): ReactElement { const { pathname } = useLocation() + const [searchParams] = useSearchParams() const [hasTagsNotification, setHasTagsNotification] = useAtom( hasTagsNotificationAtom @@ -20,6 +21,16 @@ export default function NavBar(): ReactElement { } }, [pathname, setHasTagsNotification]) + useEffect(() => { + let title = 'Aha Front-End Assessment' + if (pathname === '/tags') { + title = `Tags - ${title}` + } else if (pathname === '/results') { + title = `${searchParams.get('keyword')} - ${title}` + } + document.title = title + }, [pathname, searchParams]) + return ( <>