29 lines
830 B
TypeScript
Raw Normal View History

2018-06-25 13:37:37 -06:00
import { Location } from "history";
import * as React from "react";
import { withRouter } from "react-router";
import { Link } from "react-router-dom";
import { Menu } from "semantic-ui-react";
interface NavItemProps {
to: string;
children: React.ReactNode;
}
function NavItem({ to, children }: NavItemProps) {
return <Menu.Item as={Link} to={to} active={location.pathname.startsWith(to)}>{children}</Menu.Item>;
}
function NavBar({ location }: { location: Location }) {
return (
<Menu>
<NavItem to="/devices/grinklers">Device grinklers</NavItem>
<NavItem to="/messagesTest">Messages test</NavItem>
<Menu.Menu position="right">
<NavItem to="/login">Login</NavItem>
</Menu.Menu>
2018-06-25 13:37:37 -06:00
</Menu>
);
}
export default withRouter(NavBar);