diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-02-04 20:20:39 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-02-04 20:20:39 +0100 |
commit | c6762af035e354e41a12af143f3fc5094551687e (patch) | |
tree | 46bbb796acaee0ae1fc3d2f5df5ec8ad44c4d780 /components/navbar.tsx | |
parent | 6de323e009a54f8416d6e99e2026ec9fbc2d8772 (diff) |
font size change
Diffstat (limited to 'components/navbar.tsx')
-rw-r--r-- | components/navbar.tsx | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/components/navbar.tsx b/components/navbar.tsx index 7725ca8..9a3f9ff 100644 --- a/components/navbar.tsx +++ b/components/navbar.tsx @@ -1,4 +1,5 @@ -import { CSSProperties } from "react"; +import { CSSProperties, Component } from "react"; +/* import axios from "axios"; */ import { LogoDark } from "../components/logo"; @@ -8,6 +9,7 @@ import ExtensionIcon from '@material-ui/icons/Extension'; import SearchIcon from '@material-ui/icons/Search'; import SettingsIcon from '@material-ui/icons/Settings'; import PersonIcon from '@material-ui/icons/Person'; +import {AccountAvatar} from "./account"; var NavBarItemStyle: CSSProperties = { margin: 12, @@ -15,9 +17,22 @@ var NavBarItemStyle: CSSProperties = { display: "block" } -export function NavBar() { - return ( - <div className="navbar" style={{ +export class NavBar extends Component { + state: { + loggedIn: boolean + } = { + loggedIn: false + } + + constructor(props: {}) { + super(props); + + if (typeof window === "undefined") return; // return if run on server + this.state.loggedIn = document.cookie.includes("token"); + } + + render () { + return <div className="navbar" style={{ width: 48, height: "100%", @@ -45,19 +60,16 @@ export function NavBar() { left: 0, backgroundColor: "var(--background)" }}> - <a href="/login" style={NavBarItemStyle}> - <div style={{ - width: 24, - height: 24, - /* background: "#888888", */ - borderRadius: 12 - }}> + <a href={this.state.loggedIn ? "/account" : "/login"} style={NavBarItemStyle}> + { + this.state.loggedIn ? + <AccountAvatar size={24} dummy round/> : <PersonIcon/> - </div> + } </a> <a href="/settings" style={NavBarItemStyle}><SettingsIcon/></a> </div> </div> - ); + } } |