import React, { useState } from "react"; import { AppBar, Toolbar, Box, Link as MuiLink, ButtonBase, Tooltip, } from "@mui/material"; import { alpha } from "@mui/material/styles"; import OpenInNewIcon from "@mui/icons-material/OpenInNew"; import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined"; import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined"; import { Link, useLocation } from "react-router-dom"; const Navigation = ({ onToggleTheme, mode }) => { const [hasChanged, setHasChanged] = useState(false); const location = useLocation(); const handleThemeToggle = () => { setHasChanged(true); onToggleTheme(); }; const iconStyle = { fontSize: "1.125rem", ...(hasChanged && { animation: "rotateIn 0.3s cubic-bezier(0.4, 0, 0.2, 1)", "@keyframes rotateIn": { "0%": { opacity: 0, transform: mode === "light" ? "rotate(-90deg) scale(0.8)" : "rotate(90deg) scale(0.8)", }, "100%": { opacity: 1, transform: "rotate(0) scale(1)", }, }, }), }; const linkStyle = (isActive = false) => ({ textDecoration: "none", color: isActive ? "text.primary" : "text.secondary", fontSize: "0.8125rem", opacity: isActive ? 1 : 0.8, display: "flex", alignItems: "center", gap: 0.5, paddingBottom: "2px", cursor: "pointer", position: "relative", "&:hover": { opacity: 1, color: "text.primary", }, "&::after": isActive ? { content: '""', position: "absolute", bottom: "-4px", left: "0", width: "100%", height: "2px", backgroundColor: (theme) => alpha( theme.palette.text.primary, theme.palette.mode === "dark" ? 0.3 : 0.2 ), borderRadius: "2px", } : {}, }); const Separator = () => ( ({ width: "4px", height: "4px", borderRadius: "100%", backgroundColor: alpha( theme.palette.text.primary, theme.palette.mode === "dark" ? 0.2 : 0.15 ), })} /> ); return ( Explorer How to submit {/* About */} ({ color: "text.secondary", borderRadius: "100%", padding: 0, width: "36px", height: "36px", display: "flex", alignItems: "center", justifyContent: "center", transition: "all 0.2s ease-in-out", "&:hover": { color: "text.primary", backgroundColor: alpha( theme.palette.text.primary, theme.palette.mode === "dark" ? 0.1 : 0.06 ), }, })} > {mode === "light" ? ( ) : ( )} ); }; export default Navigation;