aboutsummaryrefslogtreecommitdiff
path: root/components/navbar.tsx
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-02-06 11:19:59 +0100
committerlonkaars <l.leblansch@gmail.com>2021-02-06 11:19:59 +0100
commit26a0e352c62889e630a84b0333f4148f740fdd7f (patch)
tree28bee016b1af48733685aa8619ce6f2b5aecc8bf /components/navbar.tsx
parent6ddbbe145f70fd76f8c60a2eb86efdebd6768d06 (diff)
added fullwidth prop to Vierkant
Diffstat (limited to 'components/navbar.tsx')
-rw-r--r--components/navbar.tsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/components/navbar.tsx b/components/navbar.tsx
index 9a3f9ff..c62965a 100644
--- a/components/navbar.tsx
+++ b/components/navbar.tsx
@@ -27,11 +27,14 @@ export class NavBar extends Component {
constructor(props: {}) {
super(props);
- if (typeof window === "undefined") return; // return if run on server
- this.state.loggedIn = document.cookie.includes("token");
}
render () {
+ if (typeof window !== "undefined") { // hot garbage but werks :tada:
+ var loggedIn = document.cookie.includes("token");
+ if (this.state.loggedIn != loggedIn)
+ this.setState({ loggedIn });
+ }
return <div className="navbar" style={{
width: 48,
height: "100%",
@@ -60,13 +63,13 @@ export class NavBar extends Component {
left: 0,
backgroundColor: "var(--background)"
}}>
- <a href={this.state.loggedIn ? "/account" : "/login"} style={NavBarItemStyle}>
- {
- this.state.loggedIn ?
- <AccountAvatar size={24} dummy round/> :
- <PersonIcon/>
- }
- </a>
+ <a href={this.state.loggedIn ? "/account" : "/login"} style={NavBarItemStyle}>
+ {
+ this.state.loggedIn ?
+ <AccountAvatar size={24} dummy round/> :
+ <PersonIcon/>
+ }
+ </a>
<a href="/settings" style={NavBarItemStyle}><SettingsIcon/></a>
</div>
</div>