polsevev.dev/polsevev.dev.frontend/src/components/TopBar.tsx

22 lines
521 B
TypeScript
Raw Normal View History

2023-08-24 14:31:35 +00:00
import React from "react";
2023-08-23 13:19:58 +00:00
2023-08-24 14:31:35 +00:00
import { NavItem, Wrapper } from "../styles/TopBarStyle";
import { useNavigate } from "react-router-dom";
2023-08-23 13:19:58 +00:00
2023-08-24 14:31:35 +00:00
const TopBar: React.FC = () => {
const navigate = useNavigate();
const handleClick = (loc:string) => navigate(loc);
2023-08-23 13:19:58 +00:00
2023-08-24 14:31:35 +00:00
const locations:Array<string> = ["/", "about"];
2023-08-23 13:19:58 +00:00
2023-08-24 14:31:35 +00:00
return (
<>
<Wrapper>
{locations.map((location) =>
<NavItem onClick={() => handleClick(location)}>{location}</NavItem>
)}
</Wrapper>
</>);
};
export default TopBar;