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>
|
2018-07-02 15:22:59 -06:00
|
|
|
<Menu.Menu position="right">
|
|
|
|
<NavItem to="/login">Login</NavItem>
|
|
|
|
</Menu.Menu>
|
2018-06-25 13:37:37 -06:00
|
|
|
</Menu>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withRouter(NavBar);
|