diff --git a/src/sections/layout/NavBar.tsx b/src/sections/layout/NavBar.tsx index 913390b..9916ace 100644 --- a/src/sections/layout/NavBar.tsx +++ b/src/sections/layout/NavBar.tsx @@ -3,18 +3,32 @@ import Box from "@mui/material/Box"; import Toolbar from "@mui/material/Toolbar"; import Typography from "@mui/material/Typography"; import IconButton from "@mui/material/IconButton"; -import { useEffect, useState, useCallback } from "react"; +import { useEffect, useState } from "react"; import NavMenu from "./NavMenu"; import { Icon } from "@iconify/react"; import { useRouter } from "next/router"; import NavLink from "@/components/NavLink"; import Image from "next/image"; +import { styled } from "@mui/material/styles"; interface Props { darkMode: boolean; switchDarkMode: () => void; } +// Styled component to make the link look like a button +const StyledIconButtonLink = styled("a")({ + color: "inherit", + display: "inline-flex", + alignItems: "center", + justifyContent: "center", + textDecoration: "none", // Remove underline from link + // Add any other styles to make it look like a button, e.g., padding, borderRadius + "&:hover": { + cursor: "pointer", // Change cursor on hover + }, +}); + export default function NavBar({ darkMode, switchDarkMode }: Props) { const [drawerOpen, setDrawerOpen] = useState(false); const router = useRouter(); @@ -23,17 +37,6 @@ export default function NavBar({ darkMode, switchDarkMode }: Props) { setDrawerOpen(false); }, [router.pathname]); - const handleIconClick = useCallback((url: string, event: React.MouseEvent) => { - if (event.button === 0 || event.button === 1) { - // Left click (0) or middle click (1) - window.open(url, "_blank", "noopener,noreferrer"); - if (event.button === 0) { - // If left click, focus the new tab - window.focus(); - } - } - }, []); - return ( - - handleIconClick("https://discord.gg/Yr99abAcUr", event) - } + + - - - + + + + + - handleIconClick("https://github.com/GuillaumeSD/Chesskit", event) - } > - - + + + + +