Add user name to navigation drawer

This commit is contained in:
André Wahlberg 2020-12-04 11:52:41 +01:00
parent 093199d0e0
commit 051afedcc5
2 changed files with 19 additions and 1 deletions

17
src/classes/User.js Normal file
View File

@ -0,0 +1,17 @@
/*
Denna klass är en modell för användare.
name : String (Användarnamn)
deviceId : Int (Enhetens ID)
location : Coordinates (Användarens koordinater)
*/
class User {
constructor(name, deviceId, location) {
this.name = name;
this.deviceId = deviceId;
this.location = location;
}
}
export default User;

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import './css/NavigationDrawer.css'; import './css/NavigationDrawer.css';
import globalData from '../GlobalData.js';
import DisruptionButton from "./DisruptionButton.js"; import DisruptionButton from "./DisruptionButton.js";
import userIcon from '../img/user.svg'; import userIcon from '../img/user.svg';
@ -36,7 +37,7 @@ class NavigationDrawer extends Component {
<div id="navDrawer" className={`${this.state.open ? "open" : ""}`}> <div id="navDrawer" className={`${this.state.open ? "open" : ""}`}>
<header> <header>
<img src={userIcon} alt="" /> <img src={userIcon} alt="" />
<span>Mitt konto</span> <span>{globalData.user.name}</span>
<span>example@gmail.com</span> <span>example@gmail.com</span>
</header> </header>
<div id="navList"> <div id="navList">