Implemented tab title = current page
This commit is contained in:
@@ -7,6 +7,10 @@ const nextConfig: NextConfig = {
|
|||||||
protocol: "https",
|
protocol: "https",
|
||||||
hostname: "techmasters.space",
|
hostname: "techmasters.space",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
protocol: "https",
|
||||||
|
hostname: "tech-masters.guru",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import { BellOutlined, UserOutlined } from "@ant-design/icons";
|
|||||||
import { Avatar, Button, Menu, MenuProps, Typography } from "antd";
|
import { Avatar, Button, Menu, MenuProps, Typography } from "antd";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import { useEffect, useMemo } from "react";
|
||||||
import styles from "./Header.module.css";
|
import styles from "./Header.module.css";
|
||||||
|
|
||||||
const { Title } = Typography;
|
const { Title } = Typography;
|
||||||
@@ -31,7 +33,41 @@ const items: MenuProps['items'] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const TITLE_SUFFIX = "Tech Masters";
|
||||||
|
|
||||||
const Header = () => {
|
const Header = () => {
|
||||||
|
const pathname = usePathname();
|
||||||
|
|
||||||
|
const selectedKey = useMemo(() => {
|
||||||
|
if (!pathname || pathname === "/") return "home";
|
||||||
|
const key = pathname.split("/")[1];
|
||||||
|
return key || "home";
|
||||||
|
}, [pathname]);
|
||||||
|
|
||||||
|
const pageTitle = useMemo(() => {
|
||||||
|
switch (selectedKey) {
|
||||||
|
case "home":
|
||||||
|
return "Home";
|
||||||
|
case "services":
|
||||||
|
return "Services";
|
||||||
|
case "projects":
|
||||||
|
return "Projects";
|
||||||
|
case "about":
|
||||||
|
return "About";
|
||||||
|
case "contact":
|
||||||
|
return "Contact";
|
||||||
|
case "testimonials":
|
||||||
|
return "Testimonials";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, [selectedKey]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!pageTitle) return;
|
||||||
|
document.title = `${pageTitle} | ${TITLE_SUFFIX}`;
|
||||||
|
}, [pageTitle]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<div className={styles.headerContainer}>
|
<div className={styles.headerContainer}>
|
||||||
@@ -68,7 +104,7 @@ const Header = () => {
|
|||||||
mode="horizontal"
|
mode="horizontal"
|
||||||
items={items}
|
items={items}
|
||||||
className={styles.menu}
|
className={styles.menu}
|
||||||
selectedKeys={['home']}
|
selectedKeys={[selectedKey]}
|
||||||
/>
|
/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
LinkOutlined,
|
LinkOutlined,
|
||||||
RocketOutlined,
|
RocketOutlined,
|
||||||
UserOutlined
|
UserOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
@@ -403,8 +403,8 @@ export default function ProjectsPage() {
|
|||||||
Featured <span className={styles.gradientText}>Work</span>
|
Featured <span className={styles.gradientText}>Work</span>
|
||||||
</Title>
|
</Title>
|
||||||
<Paragraph className={styles.projectsSubtitle}>
|
<Paragraph className={styles.projectsSubtitle}>
|
||||||
Discover our latest projects and see how we've helped businesses
|
Discover our latest projects and see how we've helped
|
||||||
achieve their digital transformation goals.
|
businesses achieve their digital transformation goals.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user