page title

This commit is contained in:
hamid zarghami
2025-08-21 09:32:23 +03:30
parent d6249713bd
commit 3b476b373a
2 changed files with 27 additions and 13 deletions
+14 -11
View File
@@ -1,13 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>راهنما</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+13 -2
View File
@@ -1,4 +1,4 @@
import { type FC } from 'react'
import { type FC, useEffect } from 'react'
import Sidebar from './components/Sidebar'
import { MessageQuestion } from 'iconsax-reactjs'
import HelpItem from './components/HelpItem'
@@ -45,6 +45,17 @@ const Home: FC = () => {
id: guide.id
})) : [];
// تغییر title صفحه با JavaScript
useEffect(() => {
if (service?.name) {
document.title = `راهنما ${service.name}`
} else {
document.title = 'راهنما'
}
}, [service?.name])
if (!service?.name) return null
return (
<div className='p-8 flex gap-8'>
<Sidebar guides={guides} service={service} />
@@ -56,7 +67,7 @@ const Home: FC = () => {
<MessageQuestion variant='Bold' size={40} color='#0038FF' />
<div>
<div className='font-bold'>
شروع سریع با {service?.name}
راهنما {service?.name}
</div>
<div className='text-sm mt-3 text-gray-600 max-w-2xl'>
{service?.description}