File size: 2,025 Bytes
e7185a2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | import styled from 'styled-components';
import React from 'react'
import { Link,useLocation} from "react-router-dom";
import { media } from "../Utils/helper.js"; // 👈 adjust path as needed
function Nav() {
const location = useLocation();
return (
<NavBar className="nav-bar">
<NavLink to="/home" $active={location.pathname === "/home"}>Home</NavLink>
<NavLink to="/request" $active={location.pathname === "/request"}>Submit Model</NavLink>
{/* <NavLink to="/leaderboard" $active={location.pathname === "/leaderboard"}>Leaderboard</NavLink> */}
<NavLink to="/metrics" $active={location.pathname === "/metrics"}>Metrics</NavLink>
<NavLink to="/dataset" $active={location.pathname === "/dataset"}>Dataset</NavLink>
<NavLink to="/contact" $active={location.pathname === "/contact"}>Contact Us</NavLink>
</NavBar>
)
}
const NavBar = styled.div`
display: flex;
justify-content: center;
gap: 3rem;
margin-inline: auto;
padding: 0.8rem;
/* background: rgba(22, 52, 250, 0.2); */
background-color: rgb(243, 245, 250);
border: 1.5px solid rgb(209, 209, 209);
backdrop-filter: blur(10px);
border-radius: 15px;
@media ${media.tablet} {
gap: 2rem;
padding: 0.5rem;
}
@media ${media.mobile} {
gap: 1rem;
padding: 0.4rem;
}
@media (max-width: 370px) {
flex-wrap: wrap ;
gap: 1.5rem;
}
`;
// Styled Link with Active Highlighting
const NavLink = styled(Link)`
text-decoration: none;
font-size: 1.3rem;
font-weight: bold;
color: ${({ $active }) => ($active ? "#3b82f6" : "#000000")};
border-bottom: ${({ $active }) => ($active ? "3px solid #3b82f6" : "none")};
/* transition: color 0.3s, border-bottom 0.3s; */
display: flex;
align-items: center;
justify-content: center;
text-align: center;
&:hover {
color: #3b82f6;
}
@media ${media.tablet} {
font-size: 1.1rem;
}
@media ${media.mobile} {
font-size: 0.9rem;
}
`;
export default Nav
|