This commit is contained in:
Kirill
2026-05-24 15:48:33 +05:00
parent 88fedd675a
commit 96f06c79b4
15 changed files with 65 additions and 13 deletions
+22
View File
@@ -0,0 +1,22 @@
import { useEffect } from 'react'
import { useLocation } from 'react-router-dom'
const BASE_TITLE = 'Любимый Креатив — Изделия ручной работы'
let currentTitle: string = BASE_TITLE
export function usePageTitle(title: string | null) {
useEffect(() => {
currentTitle = title ? `${title} — Любимый Креатив` : BASE_TITLE
document.title = currentTitle
}, [title])
}
export function usePageTitleReset() {
const location = useLocation()
useEffect(() => {
document.title = BASE_TITLE
currentTitle = BASE_TITLE
}, [location.pathname])
}