You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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>
|
|
|
|
</Menu>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withRouter(NavBar);
|