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