Skip to content

Commit b1637dd

Browse files
Merge pull request #90 from priyansh-narang2308/feat/global-docs-access-button
[WOC] Add global help button linked to EA-Run example
2 parents ca97cda + cf829e3 commit b1637dd

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

app/_components/HelpDocsButton.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use client";
2+
3+
import { usePathname } from "next/navigation";
4+
import { BookOpen, BookUp2, ExternalLink } from "lucide-react";
5+
const HelpDocsButton = () => {
6+
const pathname = usePathname();
7+
if (pathname === "/") return null;
8+
return (
9+
<a
10+
href="https://evolutionary-algorithms-on-click.github.io/user_docs/user-guide/ea-run.html"
11+
target="_blank"
12+
rel="noopener noreferrer"
13+
className="fixed bottom-6 right-6 z-50 flex items-center gap-2 bg-yellow-400 hover:bg-yellow-500 text-black font-bold py-3 px-5 rounded-full shadow-2xl transition-all duration-300 transform hover:scale-105 active:scale-95 border-2 border-black"
14+
id="help-docs-button"
15+
>
16+
<BookUp2 size={20} />
17+
<span className="hidden md:inline">Read our docs</span>
18+
19+
<ExternalLink size={16} className="opacity-70" />
20+
</a>
21+
);
22+
};
23+
24+
export default HelpDocsButton;

app/layout.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import localFont from "next/font/local";
22
import "./globals.css";
33
import { PublicEnvScript } from "next-runtime-env";
4+
import HelpDocsButton from "./_components/HelpDocsButton";
45

56
const geistSans = localFont({
67
src: "./fonts/GeistVF.woff",
@@ -52,6 +53,7 @@ export default function RootLayout({ children }) {
5253
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
5354
>
5455
{children}
56+
<HelpDocsButton />
5557
</body>
5658
</html>
5759
);

0 commit comments

Comments
 (0)