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, context) { 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(i: Navbar, event) { UserService.Instance.logout(); // i.props.history.push('/'); } expandNavbar(i: Navbar, event) { i.state.expanded = !i.state.expanded; i.setState(i.state); } }