From 132bd3568f77769a44543a42af6c7be6aa117aa9 Mon Sep 17 00:00:00 2001 From: Priyanshu Maurya Date: Sun, 5 Nov 2023 15:18:31 +0530 Subject: [PATCH] rever "fix : Bug title not change on first click" (#63) --- components/NavigationLinks.tsx | 52 ++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/components/NavigationLinks.tsx b/components/NavigationLinks.tsx index b4d1067..ba48d41 100644 --- a/components/NavigationLinks.tsx +++ b/components/NavigationLinks.tsx @@ -7,7 +7,7 @@ import useMediaQuery from "@mui/material/useMediaQuery"; export default function NavigationLinks() { const [activeSection, setActiveSection] = useState(""); - const handleSectionClick = (section: string) => { + const handleSectionClick = (section) => { setActiveSection(section); }; @@ -23,11 +23,16 @@ export default function NavigationLinks() { }, }; + const handleToolsClick = () => { + document.title = "AI Fusion - Tools"; + }; - const handleClick = (event: React.MouseEvent, title: string) => { - event.preventDefault(); + const handlePromptsClick = () => { + document.title = "AI Fusion - Prompts"; + }; - document.title = `AI Fusion | ${title}`; + const handleDatasetsClick = () => { + document.title = "AI Fusion - Datasets"; }; return ( @@ -38,40 +43,43 @@ export default function NavigationLinks() { >
{ + onClick={() => { handleSectionClick("tools"); - handleClick(event, "Tools"); + handleToolsClick(); }} > Tools { + onClick={() => { handleSectionClick("prompts"); - handleClick(event, "Prompts"); + handlePromptsClick(); }} > Prompts { + onClick={() => { handleSectionClick("datasets"); - handleClick(event, "Datasets"); + handleDatasetsClick(); }} > Datasets