import { useTranslation } from 'react-i18next'; import { StyledLangButton, StyledNavbar, StyledNavBrand, StyledNavlinksWrapper } from './styles/Navbar.styled'; interface NavLink { title: string; href: string; } function scrollToSection(e: React.MouseEvent, href: string) { e.preventDefault(); document.querySelector(href)!.scrollIntoView({ behavior: 'smooth', }); } function Navlinks(props: { navlinks: NavLink[] }) { const { t } = useTranslation(); return ( {props.navlinks.map((navlink) => ( scrollToSection(e, navlink.href)}> {t(`navbar.${navlink.title}`)} ))} ); } function LanguageChoice() { const { i18n } = useTranslation(); function changeLanguage() { i18n.changeLanguage(i18n.language == 'pl' ? 'en' : 'pl'); } return ( {i18n.language} ); } const navlinks = [ // { // title: 'home', // href: '#', // }, { title: 'about', href: '#about', }, { title: 'projects', href: '#projects', }, { title: 'contact', href: '#contact', }, ]; export default function Navbar() { const { t } = useTranslation(); return ( scrollToSection(e, '#landing')}> {t('navbar.title')} ); }