import React, { useState } from 'react' import { Link } from 'react-router-dom' import PropTypes from 'prop-types'; import { NavLink, Text, ThemeIcon } from '@mantine/core' import { GearIcon, HomeIcon, PlayIcon } from '@radix-ui/react-icons' const NavbarLinks = () => { const [active, setActive] = useState(null); const links = linksList.map((link, index) => ) return (
{links}
) } const NavbarLink = ({ label, icon, to, index, active, setActive }) => { return ( ({ width: '100%', padding: theme.spacing.xs, // borderRadius: theme.radius.sm, color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black, '&:hover': { backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0], }, })} active={active === index} onClick={() => setActive(index)} component={Link} to={to} icon={ {icon} } label={ {label} } color='lime' variant='filled' > ) } NavbarLink.propTypes = { label: PropTypes.string, icon: PropTypes.object, to: PropTypes.string, index: PropTypes.number, active: PropTypes.number, setActive: PropTypes.func } const linksList = [ { label: 'Home', icon: , to: "/home" }, { label: 'Play Chess', icon: , to: "/play" }, { label: 'Settings', icon: , to: "/settings" }, ] export default NavbarLinks