Skip to content

Commit

Permalink
rever "fix : Bug title not change on first click" (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyansuMaurya authored Nov 5, 2023
1 parent 4be326b commit 132bd35
Showing 1 changed file with 30 additions and 22 deletions.
52 changes: 30 additions & 22 deletions components/NavigationLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand All @@ -23,11 +23,16 @@ export default function NavigationLinks() {
},
};

const handleToolsClick = () => {
document.title = "AI Fusion - Tools";
};

const handleClick = (event: React.MouseEvent<HTMLAnchorElement>, title: string) => {
event.preventDefault();
const handlePromptsClick = () => {
document.title = "AI Fusion - Prompts";
};

document.title = `AI Fusion | ${title}`;
const handleDatasetsClick = () => {
document.title = "AI Fusion - Datasets";
};

return (
Expand All @@ -38,40 +43,43 @@ export default function NavigationLinks() {
>
<div className="w-50 border border-[--dark-bg] dark:border-[--light-bg] rounded-3xl flex flex-row justify-evenly items-center">
<Link
className={`w-24 text-center font-semibold ${activeSection === "tools"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} rounded-l-3xl transition px-4 py-2`}
className={`w-24 text-center font-semibold ${
activeSection === "tools"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} rounded-l-3xl transition px-4 py-2`}
href="/tools"
onClick={(event) => {
onClick={() => {
handleSectionClick("tools");
handleClick(event, "Tools");
handleToolsClick();
}}
>
Tools
</Link>
<Link
className={`w-24 text-center font-semibold ${activeSection === "prompts"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} transition px-4 py-2`}
className={`w-24 text-center font-semibold ${
activeSection === "prompts"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} transition px-4 py-2`}
href="/prompts"
onClick={(event) => {
onClick={() => {
handleSectionClick("prompts");
handleClick(event, "Prompts");
handlePromptsClick();
}}
>
Prompts
</Link>
<Link
className={`w-24 text-center font-semibold ${activeSection === "datasets"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} rounded-r-3xl transition px-4 py-2`}
className={`w-24 text-center font-semibold ${
activeSection === "datasets"
? "bg-green-500 text-white"
: "hover:bg-[color:var(--primary-color)] hover:text-white focus:bg-[--primary-color]"
} rounded-r-3xl transition px-4 py-2`}
href="/datasets"
onClick={(event) => {
onClick={() => {
handleSectionClick("datasets");
handleClick(event, "Datasets");
handleDatasetsClick();
}}
>
Datasets
Expand Down

1 comment on commit 132bd35

@vercel
Copy link

@vercel vercel bot commented on 132bd35 Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

aifusion – ./

aifusion-priyansu.vercel.app
aifusion.vercel.app
aifusion-git-main-priyansu.vercel.app

Please sign in to comment.