import { Component, linkEvent } from 'inferno'; import { Link } from 'inferno-router'; import { repoUrl } from '../utils'; import { UserService } from '../services'; export class Navbar extends Component { constructor(props: any, context: any) { super(props, context); this.state = {isLoggedIn: UserService.Instance.loggedIn, expanded: false}; // Subscribe to user changes UserService.Instance.sub.subscribe(user => { let loggedIn: boolean = user !== null; this.setState({isLoggedIn: loggedIn}); }); } render() { return (
{this.navbar()}
) } // TODO class active corresponding to current page // TODO toggle css collapse navbar() { return ( ); } handleLogoutClick() { UserService.Instance.logout(); } expandNavbar(i: Navbar) { i.state.expanded = !i.state.expanded; i.setState(i.state); } }